• <?php $my_query = new WP_Query('meta_key=Product&meta_value=Shirts') ?>

    How can I use above in some kind of conditional statement.

    I need to display different content based on the meta_value that is entered into the custom field

    Thanks

Viewing 3 replies - 1 through 3 (of 3 total)
  • How about:

    <?php $type = get_post_meta('Product', true);
    $my_query = new WP_Query('meta_key=Product&meta_value=' . $type);
    ?>
    Thread Starter krystiank

    (@krystiank)

    Awesoe, now how can I use this for such a scenario:

    <?php $type = get_post_meta('Product', true);
    $my_query = new WP_Query('meta_key=Product&meta_value=' . $type);
    ?>

    if meta_value = white, show this content

    else if meta_value = brown, show this content

    else if meta_value = red, show this content

    etc.

    sorry, but I simply cannot write it. Can you help me writing conditional statement for meta_value

    The code should work “as is”.

Viewing 3 replies - 1 through 3 (of 3 total)
  • The topic ‘How to display diffrent content based on the meta_value’ is closed to new replies.