How to use If, If Else and else in WordPress

Refer ElseIf/Else If.

But looks like a) you’re having trouble with mixing PHP and HTML incorrectly, and b) you’re not sure of logic to test if post image exists (can’t help with that, sorry). Try this:

<?php 
if ( has_post_thumbnail() ) :
    the_post_thumbnail();
elseif ( /*Some logic here to test if your image exists*/ ): ?>
    <img src="<?php echo catch_that_image() ?>" width="64" height="64" alt="<?php the_title(); ?>" />
<?php else: ?>
    <img src="http://www.technoarea.in/wp-content/themes/TA/images/TA_Logo.png" width

Leave a Comment