How To Add Featured Image Support To A WordPress Theme

Posted: Sep 2011

If you look beside this post, you will see an icon or image of the WordPress badge. This was added to the post so it displays as a ‘Featured Image’ or Post Thumbnail and it can be set so it clicks through to the blog post.

Adding Featured Image support to a WordPress Theme is a pretty simple process and aside from the styling, requires only a bit of cut and paste.

You are going to edit 3 files:

1. functions.php

2. index.php (or loop.php)

3. style.css

Open up your functions.php file and paste this in:

// add featured image support
add_theme_support( ‘post-thumbnails’ );
You need to make sure it is between for it to add support for featured images, or post-thumbnails as they are called.
Save the file and open up your index.php (or loop.php for child themes) file. Add this code, wherever you want it to appear in the loop:

Save the file and style it by opening your style.css and adding something like this:

/* ==== featured image ==== */
.attachment-post-thumbnail {
margin-right: 10px;
margin-bottom: 10px;
Once you save this file, log in to your WordPress admin panel and you will see a new palette on the sidebar.