Take the 2-minute tour ×
WordPress Development Stack Exchange is a question and answer site for WordPress developers and administrators. It's 100% free, no registration required.

Does anyone know if it is possible to add a secondary Featured image function to the pages and post editor?

share|improve this question

1 Answer 1

First thing you need to do is install and activate the Multiple Post Thumbnails plugin. After activating the plugin, you need to add the following code in your theme’s functions.php file. You can add it anywhere in the file as long as you are doing it right. Read our guide on how to paste snippets from the web.

 if (class_exists('MultiPostThumbnails')) {

 new MultiPostThumbnails(array(
   'label' => 'Secondary Image',
   'id' => 'secondary-image',
   'post_type' => 'post'
) );

}

Even though you can add a secondary featured image in your WordPress admin, it will not display on your site until you configure your theme. All you need to do is add the following code inside your post loop where you want to display it. This could be in your single.php (for single posts), archive.php (only for archive pages), etc.

   if (class_exists('MultiPostThumbnails')) : 

      MultiPostThumbnails::the_post_thumbnail(get_post_type(), 'secondary-image');

   endif;
share|improve this answer
    
Please avoid answers with just links. When they die, the answer becomes useless :/. Please include code/explanation as apart of your answers :) –  Stephen Harris Aug 15 '13 at 14:13
    
Okay cool. I will give it a shot. Thanks a lot for your time to answer my question. I am really grateful for that. –  Wayne Hatter Jr. Aug 24 '13 at 12:30

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.