[Plugin: Multiple Post Thumbnails] Display thumbnails from more than one custom post type
-
I’ve registered a secondary post thumbnail for multiple post types using the following code:
if (class_exists('MultiPostThumbnails')) { $types = array('events', 'exhibitions'); foreach($types as $type) { $thumb = new MultiPostThumbnails(array( 'label' => 'Secondary Image', 'id' => 'secondary-image', 'post_type' => $type ) ); } }
However, how can I show thumbnails from these multiple post types in the same place? (For example I have a ‘What’s on’ page that shows content from both Events and Exhibitions). I’ve tried using an array, eg:
<?php if (class_exists('MultiPostThumbnails') && MultiPostThumbnails::has_post_thumbnail(array('events','exhibitions'), 'secondary-image')) : MultiPostThumbnails::the_post_thumbnail(array('events','exhibitions'), 'secondary-image'); endif; ?>
But it doesn’t work. Any ideas? Ideally I’d like to not have to declare what post type the thumbnail is associated with, just like how the regular post thumbnail works.
Thanks in advance for any help!
Davehttps://www.ads-software.com/extend/plugins/multiple-post-thumbnails/
Viewing 3 replies - 1 through 3 (of 3 total)
Viewing 3 replies - 1 through 3 (of 3 total)
- The topic ‘[Plugin: Multiple Post Thumbnails] Display thumbnails from more than one custom post type’ is closed to new replies.