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

Image size to display not working #122

Closed ushergrey closed 7 years ago

ushergrey commented 7 years ago

Hi,

Very Useful and awesome plugin. Image size to display not working. Need help.

This is my code.

functions.php

add_theme_support( 'post-thumbnails' ); set_post_thumbnail_size( 480, 240, true ); add_image_size( 'post-thumbnail-768', 768, 384, true );

front-page.php

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

I want to set a custom size. If I set the 'post-thumbnail' or 'post-thumbnail-768' it will not be working.

Also, the backend Secondary Image size also not showing correctly.

Please need your help

Thanx

chrisscott commented 7 years ago

The thumbnail size is the fourth argument to MultiPostThumbnails::the_post_thumbnail() so you'd need to set that and use null as the third argument and it should work.

ushergrey commented 7 years ago

Hi,

Thank you very much it, worked.

Another issue in multi-post-thumbnails-admin.js (line 45, col 8)

TypeError: win.MultiPostThumbnails is undefined.

win.MultiPostThumbnails.setThumbnailID(thumb_id, id, post_type); win.MultiPostThumbnails.setThumbnailHTML(str, id, post_type);

I just remove the win. in both lines. it worked. I think you should update the plugin in WordPress repository.

Thanx.