Post Thumbnails in WordPress 3.0.4

In this follow-on post, I will show you to get post thumbnails showing up next to posts in a stock install of wordpress 3.0.4 with a few minor improvements.

First, Read through the original article on setting up post thumbnails in twenty ten. These instructions still work in wordpress 3.0.4.

The only thing you have to watch out is the names of the thumbnails, for example in the article I change the default thumbnail size and then I add an additional thumbnail size called “single”. In the html output, wordpress attaches different class names to different thumbnail sizes so you can have different css rules. In my case the thumbnail css rules will be img.attachment-post-thumbnail and img.attachment-single-post-thumbnail. I use these rules to float the images to the left of my post text.

You should also use has_post_thumbnail to check that a post has a thumbnail as well.

I have attached my basic theme below that showcases the thumbnail setup, simply unzip it in your wordpress 3 themes directory to see post thumbnails in action.

Download mytheme.zip

And here is what it looks like:

Index, Category, Search View (default small thumbnail)

Single Page View with Larger Thumbnail

, ,

3 thoughts on “Post Thumbnails in WordPress 3.0.4

  • Adam says:

    Hi Greg,

    Thanks much for the files – I created a child theme and the posts are showing as thumbnails as explained.

    However, I notice that I have to set an image as a featured image before this can work.

    Is there a way (any code that I can add to your files) where the thumbnail can be generated without it being set as a featured image? I.e., the very first image of my post can be used as the thumbnail image without first setting it as the featured image?

    Thanks!

  • Christel says:

    I used this method (only for home/search & archive pages) and it used to work. But since the upgrade to wordpress 3.1 my pages are messed up. Next to the 150px thumbnail, it also shows the original image. Any idea how to get rid of the big one ?
    Thank you in advance.

Leave a Reply to Adam Cancel reply

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