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:

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

    ReplyDelete

Tmart- Free Minimal eCommerce Template

View Details/Live Preview Tmart- Free Minimal eCommerce Template 24+ Pages, 2 Homepages, 3 Shop Pages, 9 Portfolio pages. ...