WordPress Add Post Featured Image via Functions

Posted on: November 14th, 2013 by carnfield

This is a really quick and easy mod that makes a whole lot of difference to your website, old or new.

All you have to do is open your WordPress theme’s functions.php file and then go to the bottom / end of the file and find the ?>.

Right before the closing ?> add this code below:

add_theme_support( 'post-thumbnails' );

This will then enable a “Set Featured Image” option within WordPress on pages and posts.

And now how do we display this magic within the theme templates? Easy as pie, that’s how, simply post this code in your template where you wish to see the feature image:

For the absolute full instruction, along with specifying image sizes etc, then visit the WordPress Codex for Featured Post / Page Image here:


Tags: , , ,

Leave a Reply