• Resolved eastbank

    (@eastbank)


    Hello,
    I’ve been scouring for a method of doing this and have had no luck.

    I’d like to display an image conditionally based on what checkbox was selected when setting up a post. Here’s what I’ve tried:

    <?php if ( get_post_meta($page->ID, “Color Sorts”, true)==tan) { ?>

    and

    <?php if ( get_post_meta($page->ID, “Color Sorts”, true)==’tan’) { ?>

    But neither work…any help is greatly appriciated.

Viewing 2 replies - 1 through 2 (of 2 total)
  • try it with $post instead of $page (even if on a page):

    <?php if ( get_post_meta($post->ID, "Color Sorts", true)=='tan') { ?>
    Thread Starter eastbank

    (@eastbank)

    Thanks, I got it to work using this:

    <?php if ( get_post_meta($post->ID, “Color Sorts”, true)==’tan’) : ?>

Viewing 2 replies - 1 through 2 (of 2 total)
  • The topic ‘if post_meta value = X’ is closed to new replies.