Multiple Galleries per Post/Page

Update (June 22, 2016) — This feature is now provided by WordPress by default.

Ever wanted to have multiple galleries on the same post or page? Currently most of the solutions require you to manually edit gallery shortcode and add something like include="img_id_1 img_id2". Luckily, WordPress 2.9 will have this include/exclude feature built in core, but you still don’t have an easy way to select images which to include or to insert multiple galleries.

Therefore, I created a plugin called Multiple Galleries which adds checkboxes next to images in the Insert Gallery window which makes selecting images to be included in galleries fast and easy. If no checkbox is selected, all images are included.

Select images which to include in gallery

I created this plugin because I am designing a new WordPress theme for designers, artists, architects and all of the creative types where the ability to have multiple galleries per portfolio entry is very important.


  1. ovidiu says:

    How about extending this plugin so that it also supports inserting a gallery from the media Library?
    I’d be very interested as i.e. I need to insert a gallery into two different places and that is quite difficult, ex. insert a gallery into a post and a page…

    • Kaspars says:

      ovidiu, thanks for the excellent suggestion. I have been struggling with the same problem myself.

      I am thinking of a drop-down menu of all posts that have galleries and automatic generation of [gallery id="n"] upon selecting ‘Insert gallery from another post’.

  2. ovidiu says:

    Kaspars, perfect :-) I am glad you like the suggestion. Looking forward to it.

  3. niels says:

    Awesome! Thanks.

  4. niels says:

    Have you tested this in WP2.9? I’m having some difficulties re-ordering my gallery sort order with this plugin enabled.

  5. booobooooo says:

    2.9.1 here and the galleries aren’t showing up.
    I’m getting code like this:
    [gallery link="file" columns="2" include=" 408 407"] but nothing appears. Thoughts? I really want to get this to work… Thanks

  6. booobooooo says:

    the problem regarding my post above, I’ve discovered, is that the format SHOULD be include=”408,407″ so I’m going to see if I can edit the plugin to remove the spaces and get the commas back…

  7. Kaspars says:

    booobooooo, thanks for figuring this out — it must have changed with the 2.9 release. I’ll fix this in the next release of the plugin.

    In the meantime you could change (in multiple-galleries.js):

    $to_include += ' ' + $imgid;


    $to_include += $imgid + ', ';

  8. booobooooo says:

    Nice! although I think you mean:
    $to_include += $imgid + ','
    because you don’t want any spaces in there at all.

    Also, when you do another version of the plugin you might want to try to see if you can get it to leave off the last comma since I can see that causing a problem, although I haven’t seen one yet.

    One other thing: I’ve noticed that the checkboxes don’t appear when the post editor is in HTML mode. Is that really the caes or am I crazy?

  9. Kaspars says:

    booobooooo, I think the extra spacing isn’t an issue; I’ll definitely fix the extra comma, though.

    It doesn’t work in HTML mode because there is no way of knowing which gallery you have selected (if there are several within the post). In WYSIWYG mode you select the gallery placeholder, which javascript can detect.

  10. booobooooo says:

    Gotcha. Just tested it and you’re right about the space after the comma not being a problem.

    It would be nice to be able to create new galleries in HTML mode, but it’s not a big deal compared to how cool the plug-in is otherwise! Great work!

  11. Ale says:

    upsss, now is working… I forgot to restart Firefox after changing javascript.

    Works great!

    Thanks again kaspars!

  12. Mael says:

    Hi, any chance to see it working with wordpress 3 ?
    I think WordPress staff should consider implementing your solution, it’s the simpliest way !

  13. Roger says:

    Hello Kaspars,

    Thanks for your great plugin.

    WOOOW! I spent several hours trying to make the plugin work just because I always work in HTML mode.
    Hopefully I finally found the answer in these comments (thanks also to booooboooo)

    I would suggest you really emphasized in your “READ ME” text that the plugin ONLY works in VISUAL MODE.

    Thanks again and keep up the good work!


  14. summitr says:

    Great plugin. It works exactly as advertised.

    Any chance you could add some pagination for galleries?

  15. riasaurusrex says:

    Thank You for this plugin!!!!!!!!!
    It’s exactly what I was needing for a site using WP as a CMS.
    Awesome! Thank you, thank you, thank you.
    Of course, I do have a suggestion: having a column label for the check marks that says ‘add to gallery’ or something—in the instance of passing the site off to a client that could be helpful (they’re so often easily confused).
    Any chance you know how to get the galleries to show just 1 column, or 1 image at a time for that matter? Thanks

  16. Paul Schlereth says:

    For some reason this plugin doesn’t seem to work for me in WP 3.0. The shortcode it generates seems to be ok though. Thoughts?

    • Kaspars says:

      Paul, it looks like it doesn’t add the include parameter when you upload the images the first time. If you insert a new gallery and then edit it to include specific images, it should work. I just tested it on this very blog.

      I’ll try to fix this bug. It must be related to the 3.0 changes in javascript that inserts those galleries.

  17. Leon says:

    Thank you very much for this plugin! Exactly what I needed. Just plain and simple, perfect!


  18. steve says:

    Hi there, I am using your plugin but something does not work for me:
    When I go to insert the second gallery on the post/page, the html specifies what photos should be included in that gallery but when I preview the page, it always includes all the photos from the previous gallery as well. In effect it inserts the same gallery twice.

    • Kaspars says:

      Steve, (1) insert a fresh gallery, (2) close that insert media popup and then (3) click to edit it and specify which photos to include. Secondly, take a look at the post in HTML editor mode and make sure there is the include part inside the gallery shortcode [gallery include="12, 34, ..."].

  19. steve says:

    The code seems to be correct but as you can see it doesn’t omit anything in the gallery:

    West Island Blues Fest June 2011

    Le Repaire June 2010
    [gallery include="475, 474, 473, 472, 471, 470, 469, 468, 467"]

  20. steve says:

    So now I have only one gallery:

    Le Repaire June 2010
    [gallery include="475, 474, 473, 472, 471, 470, 469, 468, 467"]

    Instead of showing 9 pix it shows all in the gallery.

  21. Ade says:

    Thank you! Thank you! Thank you! I’ve been struggling to get multiple galleries in a page for a client and this was exactly what I needed and it works great! Thanks so much!

Leave a Reply