add featured image function to wordpress themeIf your WordPress theme does not contain the featured image function, formerly known as “post thumbnails,” you can make a simple change to your template files to enable this in WordPress themes versions 2.9 and up.

You will need to modify the functions.php and add some css styling to your stylesheet found within your WordPress theme.

If you do not see the “Featured Image” section at the bottom right side of your Edit Page or Post screen, click on Appearance » and then Editor » in the left-side menu.

Now locate and click on your functions.php file listed on the right side of the panel.

To enable support for featured images, add the following code to your functions.php file:


// Add support for Featured Images
if (function_exists('add_theme_support')) {
add_theme_support('post-thumbnails');
add_image_size('index-categories', 150, 150, true);
add_image_size('page-single', 350, 350, true);
}

Edit image width and height values (ie 150, 150) to ideal default sizes for your theme structure.

To enable support for featured images on pages as well as posts, add the following code to your functions.php file:


if (function_exists('add_theme_support')) {
add_theme_support('post-thumbnails', array( 'post', 'page' ) );
add_image_size('index-categories', 150, 150, true);
add_image_size('page-single', 350, 350, true);
}

For further instructions about styling Featuring Images to WordPress and using hooks for your theme please visit Vanweerd’s blog »