Title: Trigger lightbox by another button
Last modified: March 22, 2019

---

# Trigger lightbox by another button

 *  [Suika](https://wordpress.org/support/users/suikalum/)
 * (@suikalum)
 * [7 years, 2 months ago](https://wordpress.org/support/topic/trigger-lightbox-by-another-button/)
 * Hello, is there a way I can trigger to open the lightbox using another button
   instead of clicking on the gallery images?

Viewing 3 replies - 1 through 3 (of 3 total)

 *  Plugin Author [Sayontan Sinha](https://wordpress.org/support/users/sayontan/)
 * (@sayontan)
 * [7 years, 2 months ago](https://wordpress.org/support/topic/trigger-lightbox-by-another-button/#post-11344254)
 * Not via plugin options, but some workarounds are possible. Answers to the following
   might help:
    1. Are you defining galleries in posts or pages? If you have them in pages this
       might be easy, but if you have them in posts, read on.
    2. If you have galleries on posts, does your website display full posts on the 
       category / tag / date / blog pages, or does it display excerpts? If you are 
       not displaying full posts, this might be easy, but if not, it is harder.
    3. If you are displaying galleries in pages, or if you are displaying them on posts
       but are not displaying full posts on the category / tag / date / blog pages,
       how many galleries do you have per page or post? If you have one gallery or 
       a fixed number of galleries per post / page, I believe what you are asking for
       is doable. If you provide me with a URL to your site I can help you out.
 * Basically you may be able to create a link that has the same markup as the first
   image in a gallery, but has a button or text instead of the thumbnail. Send across
   your URL and I will take a look.
 *  Thread Starter [Suika](https://wordpress.org/support/users/suikalum/)
 * (@suikalum)
 * [7 years, 2 months ago](https://wordpress.org/support/topic/trigger-lightbox-by-another-button/#post-11351187)
 * I am defining the gallery in posts, I get the album ID from a custom field in
   the custom post type. It’s a custom template for the single page, and there’s
   only one gallery in it.
 * This is what I tried so far from your suggestion – I just copied the outer div
   and anchor of the first image on the gallery and then replaced the `img` with
   a text and added some classes to make it look like a button that says “Test Launch
   Gallery” and I get that it only gets the first image because that’s what’s on
   the `href` of the link but I’d like to point it to the existing gallery itself.
 * You can check [here](https://kplmpg.preview.direct/locations/allens-house/). 
   Many thanks!
 *  Plugin Author [Sayontan Sinha](https://wordpress.org/support/users/sayontan/)
 * (@sayontan)
 * [7 years, 2 months ago](https://wordpress.org/support/topic/trigger-lightbox-by-another-button/#post-11353760)
 * Looks like this approach will not work for Magnific – Magnific groups based on
   the parent container, and in this case your button is outside the parent container
   that contains the other photos.
 * You could change your lightbox to Swipebox and try this (you will need to change
   your markup for this – the `a` tag changes).
 * Note that even if you get this to run, the first image will show up twice in 
   the lightbox, first via the button, and second via the gallery.
 * There could be other alternatives via JavaScript functions attached to the button,
   but I am not sure if the pain is worth the benefit.

Viewing 3 replies - 1 through 3 (of 3 total)

The topic ‘Trigger lightbox by another button’ is closed to new replies.

 * ![](https://ps.w.org/photonic/assets/icon.svg?rev=1972449)
 * [Photonic Gallery & Lightbox for Flickr, SmugMug & Others](https://wordpress.org/plugins/photonic/)
 * [Frequently Asked Questions](https://wordpress.org/plugins/photonic/#faq)
 * [Support Threads](https://wordpress.org/support/plugin/photonic/)
 * [Active Topics](https://wordpress.org/support/plugin/photonic/active/)
 * [Unresolved Topics](https://wordpress.org/support/plugin/photonic/unresolved/)
 * [Reviews](https://wordpress.org/support/plugin/photonic/reviews/)

## Tags

 * [button](https://wordpress.org/support/topic-tag/button/)
 * [gallery](https://wordpress.org/support/topic-tag/gallery/)

 * 3 replies
 * 2 participants
 * Last reply from: [Sayontan Sinha](https://wordpress.org/support/users/sayontan/)
 * Last activity: [7 years, 2 months ago](https://wordpress.org/support/topic/trigger-lightbox-by-another-button/#post-11353760)
 * Status: not a support question