Triggering lightbox gallery with a button


WonderPlugin Portfolio Grid Gallery


I'm wondering if there is a way to trigger a gallery with a button? In other words I just want to have a button on my page that says "View photos here" rather than displaying all the thumbnails. And when the button is clicked, the lightbox would come up with the first photo.


1. Create a grid gallery with WonderPlugin Portfolio Grid Gallery and enable lightbox for all images.

2. In your WordPress post or page editor, switch to Text mode, add the grid gallery shortcode to your post or page, then add a hidden div around it:

<div style="display:none;">
[[wonderplugin_gridgallery id=23]]

3. Add onclick event to a button and trigger the grid gallery lightbox:

<a href="#" onclick="JavaScript:jQuery('#wonderplugingridgallery-23 .wonderplugin-gridgallery-item-img').eq(0).click(); return false;">
<button>Open Grid Gallery Lightbox</button>

A demo is as follows: