How to show thumbnail in WordPress without plugin

Featured Images or Post Thumbnails is a theme feature. Most wordpress themes support featured images by default. An easy way to figure out whether your theme supports featured images is by going to the post editor. Simply create a new post and scroll down a little to see if there is a meta box called featured images on the right hand side of the screen.

featured-thumb

Please go through the below steps for adding thumbnail in your wordpress home page

Edit loop.php and find out the following line (line 142)

 


<?php the_content( __( 'Continue reading <span class="meta-nav">&rarr;</span>', 'twentyten' ) ); ?>

Replace it with following

<a href="<?php the_permalink(); ?>"><?php if ( function_exists("has_post_thumbnail") && has_post_thumbnail() ) { the_post_thumbnail(array(200,160), array("class" => "home-thumb")); } ?></a>

<?php the_excerpt(); ?>

Add the following code in style.css

.home-thumb{
width:150px;
height:150px;
float:left;
margin-right:10px
}


About hostonnet2

Bootstrap and Android LOVER. I've been creating things for the web for over 10 years, from the period of flash and table based layout web sites till mobile and tab friendly web sites.
Posted in Wordpress