Enhance your custom theme – Part 2
Step 3: Enhance blog posts with post thumbnails
Custom fields were frequently used to display featured images, but WordPress version 2.9 introduced Post Thumbnails and made this process redundant. The the_post_thumbnail() function is the method of choice for displaying featured images.
To use Post Thumbnails, you need the following code in your functions.php file.
add_theme_support( 'post-thumbnails' );
Once you’ve declared theme support for this feature, a new “Featured Image” area will appear in your admin UI. This is usually found in the bottom right hand side of your Page admin UI.
To add a featured image, simply click the link, add a new image like you would any other image and select “Use as featured image” instead of insert into post. The size of the thumbnail will be determined by the Media Settings, but you can add additional using the following code in your functions.php file like so:
set_post_thumbnail_size( 200, 150, true ); add_image_size( 'single-post-thumbnail', 350, 9999 );