Support » Fixing WordPress » Conditional Statement

  • Resolved bloomcreative

    (@bloomcreative)


    Trying to construct a conditional statement that tests whether a post has either meta info (for a custom image) or a feature image:

    $image="Recipe Image";
    $recipeimage=get_post_meta($post->ID, $image, true);
    
    if ( ! $recipeimage && has_post_thumbnail() = 'false'){ ?>
    
    <img src="<?php bloginfo('template_directory'); ?>/images/no-recipe-image.jpg" alt="" class="alignright" />
    
    <?php } ?>

    So if the meta variable returns false and there is no post thumbnail, we display the alternate image.

    Anyone have any idea why this is not working?

    Thanks in advance.

Viewing 2 replies - 1 through 2 (of 2 total)
Viewing 2 replies - 1 through 2 (of 2 total)
  • The topic ‘Conditional Statement’ is closed to new replies.