Support » Plugin: Multiple Post Thumbnails » Exclude the thumbnail from gallery

Viewing 5 replies - 1 through 5 (of 5 total)
  • Plugin Author Chris Scott


    You can use the ‘exclude’ attribute of the gallery shortcode and pass in the id of the second thumbnail. e.g. [gallery exclude=22] to exclude the image with id 22. Not very flexible but it is easy and doesn’t require any development.



    It’s right, it works.
    The problem is that the final client will not be able to do this for sure.

    I can also use the :last CSS propertie and tell the client to put the thumbnail at the end of the gallery.

    Allow to exclude the multiple thumbnail of the content attachments could be an usefull feature, don’t you think ?

    Anyway, thanks for answering.

    Plugin Author Chris Scott


    The only somewhat clean way I can see to do this in code is to filter post_gallery but that would mean duplicating all of the gallery shortcode output code and having the calls to get_children() pass in the exclude id.


    (@lorembolo) dos not seems easy for a beginner like me !

    Well, for this particular project, the best way is to invert the use of thumbnails. This way, the 2nd thumbnail for an artist, wich is a painting, can be included in the gallery. And the regular Thumbnail can be used to display the pic of the artist.
    (does it make sense?)

    Many thanks for your work, it helped me.

    Hello, I would also love to be able to exclude the extra thumbnail from a gallery. The client will not be able to add the gallery shortcode themselves, so ‘exclude=22’ won’t work.

    What I have done is place this in the template:

    <?php  $thumbnail_id = get_post_thumbnail_id(get_the_ID()); ?>
    <?php echo do_shortcode('[gallery exclude='.$thumbnail_id.']'); ?>

    This removes the regular thumbnail, but not my secondary thumbnail. Any ideas?


Viewing 5 replies - 1 through 5 (of 5 total)
  • The topic ‘Exclude the thumbnail from gallery’ is closed to new replies.