Support » Plugin: Lightbox with PhotoSwipe » Works great but multiple galleries on a page are complicated

  • The plugin is very easy to set up and the galleries look stunning! It works seamlessly with images uploaded to the WordPress media library and also with the NextGEN Gallery plugin. The conflict with Advanced Gutenberg (now called PublishPress Blocks) is documented and the workaround was easy by following the FAQ.

    The only thing I find unsatisfactory is adding HTML attributes (data-lbwps-gid or tabindex). There is no option to add them using Gutenberg and when I do it using HTML code, the block is then considered invalid by Gutenberg. I suppose extending the Block Settings Sidebar or the link creation pop-up is possible as other plugins extend them, too.

Viewing 6 replies - 1 through 6 (of 6 total)
  • Plugin Author Arno Welzel

    (@awelzel)

    Gutenberg galleries don’t need data-lbwps-gid if you want to have them as a separate lightbox – they are supported using the backend option “Show WordPress galleries and Gutenberg gallery blocks in separate lightboxes”. In this case Lightbox with PhotoSwipe adds a hook to the render_block filter of Gutenberg to add the required attributes to Gutenberg gallery images.

    The attributes are only documented in case you want to show a group of images wich are not part of a gallery in their own collection and not as part of the global image collection built images on a page outside a gallery.

    Unfortunately not every gallery provides hooks to add these attributes like Gutenberg or WordPress – however if one provides a pointer to the respective documentation for filter hooks to modify the gallery output (similar to the render_block filter in Gutenberg), I’m happy to add that as well.

    About the tabindex: I can’t to anything about this at the moment – this attribute has to be added to the HTML source and there is no way to extend the existing UI in WordPress to add images with this attribute as an option. This attribute is more useful for people who can edit their HTML source to add this if needed or for software developers who create their own plugins which generate HTML output.

    Thread Starter melebius

    (@melebius)

    Thank you for your quick reply! I don’t use Gutenberg galleries – I am currently using your plugin together with NextGEN galleries and some individual images stored in my WordPress media library and placed here and there through the page. I’d like these images (or even links to them) to be expanded without leaving the page (using the lightbox) and to be treated individually, not as a common gallery, as they don’t form a meaningful set. I can achieve this using the data-lbwps-gid attribute but this has the disadvantages I described earlier. (I mentioned tabindex just for completeness and haven’t used it so far.)

    I was trying the Block Data Attribute plugin to add the data-lbwps-gid more comfortably. It adds fields for the data- attributes into the Block Settings Sidebar but works with buttons only. However, I suppose you could add a field (or two) there, too. Or if there were an option to open each image without data-lbwps-gid in a separate lightbox, this would solve my problem, at least for individual images. (However, it wouldn’t work with NextGEN galleries currently as they don’t include data-lbwps-gid – I am going to investigate this further.)

    Plugin Author Arno Welzel

    (@awelzel)

    No gallery includes data-lbwps-gid – this is added by my plugin using filter hooks if you enable the respective option in the backend.

    Unfortunately, unlike WordPress itself and Gutenberg gallery blocks, NextGEN does not provide any filter hooks to add additional attributes to the HTML code which NextGEN produces.

    It seems, NextGEN wraps galleries with a DIV element which gets a unique ID like “ngg-gallery-33245cef03aac5b02637e09687ac0232-1” which may be used by the frontend script to identify the gallery – however I don’t know if this is a documented behaviour since there I could not find any documentation about this.

    However – NextGEN also offers paid versions and my motivation to support other paid plugins for free is quite limited.

    Plugin Author Arno Welzel

    (@awelzel)

    In addition: using a single lightbox for each image is already noted in Github:

    https://github.com/arnowelzel/lightbox-photoswipe/issues/71

    Thread Starter melebius

    (@melebius)

    Thank you for the reactions! I solved my issue by properly configuring NextGEN (the free version) and disabling Lightbox with Photoswipe, although the NextGEN’s lightbox is not so good…

    I subscribed to the issue on GitHub and will consider increasing my rating if the issue is resolved.

    In the meantime, I translated your plugin to Czech. I hope this is sufficient compensation. 🙂

    Plugin Author Arno Welzel

    (@awelzel)

    JFTR: there is no need to disable Photoswipe for NextGEN – you can also disable the lightbox of NextGEN and use Photoswipe for NextGEN galleries as well.

    Example:
    https://wordpress-demo.arnowelzel.de/lightbox-with-photoswipe-with-nextgen-gallery/

    • This reply was modified 2 years, 8 months ago by Arno Welzel.
Viewing 6 replies - 1 through 6 (of 6 total)
  • The topic ‘Works great but multiple galleries on a page are complicated’ is closed to new replies.