The new ‘featured image’ facility on WordPress is really useful. It has to be enabled in your themes functions.php file with a couple of lines of code something like this:

add_theme_support( 'post-thumbnails' );
set_post_thumbnail_size( 266, 999 );

Once it’s enabled you can add the image very easily anywhere in the loop usingĀ <?php the_post_thumbnail(); ?>.

Mark Jaquith has written a nice article explaining how you can set up different images sizes and there’s a very useful plugin calledĀ Multiple Post Thumbnails that allows the addition of multiple featured images.

It’s not obvious how you can add a caption to a featured image. The trick lies in calling the associated attachment post. You can show the image caption using the following code:

<?php the_post_thumbnail();
echo get_post(get_post_thumbnail_id())->post_excerpt; ?>

Similarly you can show the full description or the image title if you prefer:

<?php the_post_thumbnail();
echo get_post(get_post_thumbnail_id())->post_content; ?>
<?php the_post_thumbnail();
echo get_post(get_post_thumbnail_id())->post_title; ?>

You can add any classes you need in order to style the results.