Today I was looking for a plugin to allow an image to be associated with a post. Turns out that it is a built in feature in WordPress 2.9 and newer (thanks to Mark on WordPress).

By simply adding these 2 lines to the themes function.php file, an image can become a ‘Featured Image’ on a post or page:

add_theme_support( 'post-thumbnails', array( 'post' ) );

set_post_thumbnail_size( 50, 50 ); // 50 pixels wide by 50 pixels tall, box resize mode;

Then the following code can be used to show the image:
$thumb = get_the_post_thumbnail( $page->ID );

Digg this

No Comment.

Add Your Comment