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; ?>
         
       </div>

1 comment:

Wokiee React eCommerce Template