WordPress.org

Ready to get started?Download WordPress

Forums

analyze custom key value (1 post)

  1. to_ul
    Member
    Posted 5 years ago #

    hello wp-community!
    is there a way to analyze the value of a custom field?
    for example: if my custom field contains a gif-image and not a jpg i wanna post a message and hide the custom field.

    following does not work:

    <?php
    $var = get_post_meta($post->ID, 'imageurl', true);
    if ($var !== 'jpg')
    {
    echo "<p>I'm the default text!</p>";
    } else {
    echo "hallo:" . $var . "image";
    } ?>

Topic Closed

This topic has been closed to new replies.

About this Topic