• I currently have this code:

    <?php
    if(has_post_thumbnail()) {the_post_thumbnail();}
    else {echo ‘<img alt=”img” class=”post-image” height=”70″ src=”‘.get_bloginfo(“template_url”).’/images/nopic.jpg” width=”70″ />’;}
    ?>

    The above code will show a pic from my templates directory if no thumbnail is set.
    But what I want is to show the post thumbnail, but if no thumbnail is set, show an image from a post custom field called “post-img”, and if no custom field is set, show the “nopic.jpg” img from my templates directory.

    So, I just have to add the custom field into the php if statement, but every time I try it, I get errors.

The topic ‘I need help with this if statement’ is closed to new replies.