I’m using Alex Rabe’s NextGEN Gallery in a lot of client sites as a centralized image repository, and am finding I often need to load an entire gallery into a lightbox (invoked via a single thumbnail), without displaying more than a single thumbnail on page.
Thus, I could have a series of four thumbnails on a page, each thumbnail opening a different set of pictures in a lightbox when clicked.
Any idea how I could do this? Thanks.
Output all images of each gallery in your HTML. Use an anchor tag that links to the fullsize image around each thumbnail. Depending on the lightbox plugin you prefer to use, group all images from the same gallery (often done using the
rel
attribute in HTML). At that point, just hide all but one thumbnail per gallery. Hook your lightbox plugin to the galleries.Check it out: http://jsfiddle.net/8WcUp/1/
The images are already grouped by gallery, so you simply need to determine the gallery to which the single pic belongs (which I think is
$image->galleryid
), and then droprel="lightbox[$gallery]"
into the anchor tag in yoursinglepic.php
template file.So, something like this (in the
singlepic.php
NextGen Gallery template file:If that doesn’t work, let me know and we’ll figure it out!
As of 2015 and NextGen 2.0. Don’t hack this, use shortcodes to display a single image and then lead to the lightbox:
Further documentation and useful examples.
Simply add this style to your nggallery.css file to display only the first image in the gallery. When you click the thumbnail, the lightbox effect will display all of the images. No PHP code needed: