As blogs become more and more like news magazines, it has become common to ensure that each post has an image associated with it, giving a clue to its contents. Before WordPress 2.9, retrieving this image for each post required a custom plug-in or some custom theme code. Now, it is built-in, and is easier than ever (refer to http://markjaquith.wordpress.com/2009/12/23/new-in-wordpress-2-9-post-thumbnail-images/).
You need to have a basic theme created for this recipe, including index.php, function.php
, and single.php
template files.
First, open up your theme's functions.php
file, and type the following code just below the comments section:
Add_theme_support('post-thumbnails');
Now the size of the thumbnails in the post and the corresponding image in a single page need to be set. Just below the code entered above, paste the following code:
set_post_thumbnail_size( 50, 50, true ); // Normal post thumbnails (cropped) add_image_size...