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

Multiple Post Thumbnails doesn't work with Post Thumbnail Editor #28

Closed dorotheenyc closed 10 years ago

dorotheenyc commented 10 years ago

Hello,

I just install your plugin on the blog I'm developping and it works. But (always a but), it is not compatible with my other plugin Post Thumbnail Editor.

Lets me explain. I installed the Post Thumbnail Editor plugin before because it is the best way for my client to resize the post thumbnail directly in the Worpress admin.

But when I installed your plugin, I realize the Thumbnail editor link doesn't appear under the second post thumbnail. You can see how it appears on Wordpress : http://www.slasheuse.com/wordpress-bug.png

Do you know, by any chance, how to make your plugin compatible with the Post Thumbnail Editor ? I already the author but he told me that he didn't know how to fix it.

You're my last chance :) Thanks in advance

chrisscott commented 10 years ago

@dorotheenyc I just added a new release which adds a filter (props to @gglnx for the initial PR) that can be used for this. I've only lightly tested with Post Thumbnail Editor, but if you update to that version (1.6.2) and add something like the following to your theme's functions.php, replacing [post type] and [mpt id] with the post_type and id array values you used when instantiating the MultiPostThumbnails class:

add_filter( '[post type]_[mpt id]_admin_post_thumbnail_html', 'my_pte_admin_post_thumbnail_html', 10, 3 );

function my_pte_admin_post_thumbnail_html( $content, $post_id, $thumbnail_id ){
    pte_add_thickbox();

    if ( $thumbnail_id == null )
        return $content;

    return $content .= '<p id="pte-link" class="hide-if-no-js"><a class="thickbox" href="' 
        . pte_url( $thumbnail_id, true )
        . '">' 
        . esc_html__( 'Post Thumbnail Editor', PTE_DOMAIN ) 
        . '</a></p>';
}

Note you'll need to use the link above (or git) to download version 1.6.2 since I haven't pushed this to wordpress.org yet.