WordPress.org

Ready to get started?Download WordPress

Forums

if custom field 1 OR custom field 2 has a value, then... (1 post)

  1. lorensson
    Member
    Posted 1 year ago #

    Hi guys – can't figure this out for the life of me. Here's what I've got:

    <?php if (get_post_meta ($post->ID, "apples", $single = true) || ($post->ID, "oranges", $single = true) || ($post->ID, "bananas", $single = true)) { ?>
    IF FRUIT EXISTS, SHOW THIS
    <?php } ?>

    So I want to just show something IF ANY of the custom fields have value.

    With this code, I'm getting Parse error: syntax error, unexpected ',' this is inside a get_posts loop.

Topic Closed

This topic has been closed to new replies.

About this Topic