Bootstrap Templates Bundle

Thursday, February 28, 2013

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 comment:

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


Wokiee React eCommerce Template