Chris Walton

Adding Featured Image Support to a WordPress Page

Ever wanted to be able to add a Featured Image to not just your WordPress posts but you’re pages? You can easily extend your theme by adding a single line to your functions.php file.

add_theme_support( 'post-thumbnails' );

Violla you can now upload Featured Images to your pages through the CMS. You will obviously need to then extend your themes page templates to call in the images. This can differ slightly from theme to theme so my advice is to checkout how it is applied within files such as index.php and single.php being a good place to start, you will be looking for the code which looks something like this;

<?php the_post_thumbnail('post-image'); ?>

Remember if you are using a theme sourced off of the WordPress Theme Directory you will need to remember that any updates from WordPress may remove any additions you make. For more information on this feature why not check out the WordPress Codex page on Post Thumbnails.

Tags: