HostOnNet Blog

How to show thumbnail in WordPress without plugin

Looking for Linux Server Admin or WordPress Expert? We can help.

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 Sibi Antony

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

Leave a Reply

Your email address will not be published. Required fields are marked *

This site uses Akismet to reduce spam. Learn how your comment data is processed.