Exclude the thumbnail from gallery
I’m using this plugin for a gallery portfolio I’m working on.
I use the regular thumbnail on this page wich shows a list of artists:
Then, I use a second thumbnail on the artist’s portfolio
(ex : http://www.artistigalerie.fr/artiste/francoise-calcagno/)
As you can see, the second thumbnail appears in the content if I use the gallery feature.
Does anyone knows how I could avoid this ?
Thanks in advance.
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.
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.
wow..it 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?
- The topic ‘Exclude the thumbnail from gallery’ is closed to new replies.