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

Not returning post thumbnail with custom size #72

Closed AndrewSepic closed 9 years ago

AndrewSepic commented 9 years ago

Hi Voce Team! Thanks for your work on this plugin. I'm having an issue where it won'te display the post thumbnail with a custom image size that I've set with add_image_size('slide', 755, 300, array( 'center', 'top' )); in my functions.php.

The code i'm calling in my template is..

if (class_exists('MultiPostThumbnails')) :
MultiPostThumbnails::the_post_thumbnail('post' , 'secondary-image', 'slide');
endif; ?>

Any idea's why this isn't outputting anything at all? If I remove 'slide' from the end, I get the image output, but without my sizing and crop which is specified in add_image_size.

kevinlangleyjr commented 9 years ago

@AndrewSepic it looks like you are missing one parameter from your call to MultiPostThumbnails::the_post_thumbnail(), the parameter order is, $post_type, $thumb_id, $post_id, $size, $attr, $link_to_original. Add in the $post_id between the $thumb_id and $size in your call and you should be good to go.

AndrewSepic commented 9 years ago

@kevinlangleyjr thanks for your help. I didn't know that you had to call all arguments in an array in order. So I've got..

MultiPostThumbnails::the_post_thumbnail('post' , 'secondary-image', $post->ID, 'slide');

for my output and it's working just right. Thanks!