Multiple Post Thumbnails
[resolved] Exclude secondary featured image (3 posts)

  1. Moraima R.
    Posted 4 years ago #

    Hello, how can i exclude the secondary featured image i use the following:

    <?php echo do_shortcode('[gallery columns="2" exclude="' . get_post_thumbnail_id( $post->ID ) . '"]'); ?>

    is the normal way to exclude the main featured image from the gallery.


  2. Chris Scott
    Plugin Author

    Posted 4 years ago #

    You can use MultiplePostThumbnails::get_post_thumbnail_id('post', 'secondary-thumb', $post_id) to get the post thumbnail ID for the given post type, thumbnail ID, and post ID.

  3. slurve
    Posted 4 years ago #

    I was able to accomplish this with the following code:

      $featuredA = get_post_thumbnail_id($post->ID); /* first thumbnail */
      $featuredB = MultiPostThumbnails::get_post_thumbnail_id('CUSTOM_POST_TYPE', 'SECONDARY_THUMB_NAME', $post->ID); /* second thumbnail */
      echo do_shortcode('[gallery exclude="'.$featuredA.','.$featuredB.'"]');

Topic Closed

This topic has been closed to new replies.

About this Plugin

  • Multiple Post Thumbnails
  • Frequently Asked Questions
  • Support Threads
  • Reviews

About this Topic