[resolved] if post_meta value = X (3 posts)

  1. eastbank
    Posted 5 years ago #

    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) { ?>


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

    But neither work...any help is greatly appriciated.

  2. Michael
    Forum Moderator
    Posted 5 years ago #

    try it with $post instead of $page (even if on a page):

    <?php if ( get_post_meta($post->ID, "Color Sorts", true)=='tan') { ?>
  3. eastbank
    Posted 5 years ago #

    Thanks, I got it to work using this:

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

Topic Closed

This topic has been closed to new replies.

About this Topic