PHP code for getting thumbnail and default post image

This code will help us to set default thumbnail and getting thumnail

   <div style="margin: 12px;">
         <?php if( has_post_thumbnail() ) : ?>
<?php the_post_thumbnail(array(350,250), array ('class' => 'alignleft')); ?>

<?php else : ?>
<img src="<?php echo get_bloginfo('template_directory');?>/images/defaultthumb.png" alt="Default Icon" title="Default Thumb" class="alignright" height="300px" width="460px"/>
<?php endif; ?>


  1. You need to paste it in single.php or
    post-single.php file


Post a Comment

Popular posts from this blog

Adobe Photoshop CS6 13.1.2 Extended Final Portable Download

How to display related post by category

Owl carousel slider shortcode in WordPress for Showing Posts or custom Posts