voceconnect / multi-post-thumbnails

Adds multiple post thumbnails to a post type. If you've ever wanted more than one Featured Image on a post, this plugin is for you.
143 stars 63 forks source link

Using plugin with CMSMasters templates #89

Closed walkman50 closed 8 years ago

walkman50 commented 8 years ago

Hello,

I am using a CMSMasters template (Welfate) and I am trying to display a secondary featured image on the blog posts Category page (the page is built using the Blog shortcode in the Visual Composer). I am editing the standard.php under Themes>Welfare>framework>postType>blog>page>default to try to put in the supplied code. I can break the page, so I know I am in the right place, but I cannot get the secondary image to display.

Can you recommend any changes to the supplied code, modifications to the existing code, or a different plugin to get this image to display?

Supplied code to display the image (the code to register the function is in functions.php):

<?php if (class_exists(\'MultiPostThumbnails\')) : MultiPostThumbnails::the_post_thumbnail(get_post_type(), \'secondary-image\'); endif; ?>

I've tried putting it in elseif statements along with this code:

if (!post_password_required() && has_post_thumbnail()) { cmsms_thumb(get_the_ID(), \'post-thumbnail\', true, false, true, false, true, true, false); }

Thank you, Dave

chrisscott commented 8 years ago

My guess is that you're calling MultiPostThumbnails::the_post_thumbnail() outside the loop so get_post_type() may be incorrect. Try replacing that with the post type of the post you are getting the thumbnail for (likely 'post').