WordPress.org

Ready to get started?Download WordPress

Forums

WP jQuery Lightbox
[resolved] WP jQuery Lightbox] grouping slideshows (8 posts)

  1. placeboarts
    Member
    Posted 2 years ago #

    Is there a way to "group" different galleries together so that when lightbox opens up, it doesn't keep going onto the next group of images or gallery?

    Would be great if a unique name could be added to each shortcode to keep the different galleries separate. An alteration of the "rel" tag does not work because the shortcode is being used to insert a group of images.

    Check out this page to see what I'm getting at.

    http://wordpress.org/extend/plugins/wp-jquery-lightbox/

  2. ulfben
    Member
    Plugin Author

    Posted 2 years ago #

    The assumption is that all pictures attached to a post is one set, and that multiple galleries are used primarily to format the layout.

    WP jQuery Lightbox is not aware of the shortcodes - it simply filters the post content. It might be possible to add a set identifier to the gallery shortcode, but I'm not sure.

    I'll try and look into this at some point.

    (Link for future reference
    http://wordpress.stackexchange.com/questions/9603/how-do-i-filter-title-and-alt-attributes-in-the-gallery-shortcode )

  3. ulfben
    Member
    Plugin Author

    Posted 2 years ago #

    The current implementation is really short and sweet; a single line regexp finds all links-to-images that doesn't already have a rel-attribute, adds the rel="lighbox[]" (grouping them by post ID).

    To separate a post's galleries from eachother we'd need to add the rel attribute long before this step - somewhere where WordPress is still dealing with the gallery-shortcode (and thus aware of their attributes).

    A first line of attack might be;

    1. filter post_gallery to read our new shortcode attribute ("instance" or "set")
    2. put the current set ID in a global variable to make it available to...
    3. ... a wp_get_attachment_image_attributes-filter, where we now can add rel="lightbox[#set]" to the output.
    4. ???
    5. PROFIT!

    Seems like it should work without much overhead. We'll just bail if post_gallery does not provide the set-attribute.

    One could also forego the shortcode attribute and make this behaviour a global setting - "always group by instance" or "always group by post".

    Convenient, but less flexible.

  4. placeboarts
    Member
    Posted 2 years ago #

    Thanks for the detailed response and helpful link ulfben!
    I'm not too familiar with creating wordpress filters or creating custom global settings. I'll have to read up on these more...

  5. ulfben
    Member
    Plugin Author

    Posted 2 years ago #

    Nah, I'll take care of it. It seems like reasonable functionality to support. No timeline though.

  6. steckinsights
    Member
    Posted 2 years ago #

    Thanks @ulfben. This looks like an excellent addition. I'm coming from Lightbox Plus, which uses this functionality, because I was having trouble with the title and captions not being listed correctly in the lightbox. I wanted a simplified plugin, so I'm giving yours a try. This gallery-separation functionality would be awesome!

  7. kevin@nolka.com
    Member
    Posted 1 year ago #

    Hi ulfben,
    Did you get any further with the gallery separation function? I have managed to place three galleries on a page - each taken from individual posts setup to hold each gallery. There are say 7 images in each gallery. However I am still getting all 21 images displaying in the Gallery Lightbox. Any ideas?

    Any help much appreciated...

    Kevin.

  8. ulfben
    Member
    Plugin Author

    Posted 1 year ago #

    gallery grouping is in the latest version. Here's an example of how to use it:

    [gallery link="file" ids="1,2,3" group="monday"]
    
    [gallery link="file" ids="5,6,7" group="tuesday"]

Topic Closed

This topic has been closed to new replies.

About this Plugin

About this Topic