WordPress.org

Ready to get started?Download WordPress

Forums

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

  1. Moraima R.
    Member
    Posted 2 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.

    http://wordpress.org/extend/plugins/multiple-post-thumbnails/

  2. Chris Scott
    Member
    Plugin Author

    Posted 2 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
    Member
    Posted 1 year ago #

    I was able to accomplish this with the following code:

    <?php
      $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

About this Topic