Support » Plugin: NextGEN Gallery - WordPress Gallery Plugin » [Plugin: NextGEN Gallery] [NextGen Gallery] Open album in lightbox

  • Resolved mvandemar


    I just had to solve the problem of opening up a NextGen Gallery album in a lightbox for a client (as opposed to opening it up in it’s own page first, and then clicking on a thumbnail to open the images in a lightbox), and due to the number of unanswered posts on the subject I thought I would go ahead and share my solution. This was done via a custom function, ngg’s templating system, and for what I was doing I wound up needing to use the PrettyPhoto Media plugin to get it all working nicely. First I added the following nggGetGallery() function to my client’s functions.php:

    Next I created a new template inside of nextgen-gallery/view/ named album-lightbox.php:

    This was based off of the album-compact.php template. The format for adding galleries is now:

    [album id=7 template=lightbox]

    This worked great, aside from the fact that with multiple albums on a single page it would treat them all as a single gallery. I solved this by installing the PrettyPhoto Media plugin:

    Then I went to Gallery -> Options -> Effects, changed the dropdown to Custom, and added this code:


    And voila, it all worked. I hope this helps someone else looking for a solution to that.


Viewing 15 replies - 1 through 15 (of 74 total)
  • Hi,

    I’m very interested with this solution.
    Can you show me a demo of the results ?

    Thanks a lot for your job.


    @romainvincent – Sure, it’s here:

    Photo Gallery

    One thing I did not mention in the above description was that I had to de-link the name of the gallery in the text link below the thumbnails, or it added the first image in twice to the album, once at the beginning for the thumbnail link and once for the text link.


    Thanks a lot !!! Perfect !!!
    This is exactly what I was searching for !!!
    I try it soon as possible and I tell you.

    Thank you for posting this Michael, it is exactly what I needed.



    I follow your instructions and I got this :

    Parse error: syntax error, unexpected T_NS_SEPARATOR, expecting T_STRING in /homez.548/gordonse/www/wp-content/plugins/nextgen-gallery/view/album-lightbox.php on line 20

    In this page

    Can you please paste the contents of album-lightbox.php into pastebin and post the link to that here?

    Voilà :

    But it’s exactly the same as you posted (I think…)

    According to the research it looks like it might be an issue with magic quotes being enabled on PHP 5.3, does your host allow you to use a custom php.ini? If so, I would try disabling them there, or perhaps in your .htaccess:

    See if that helps.


    I disabled Magic quotes via .htaccess but nothing changed….
    Which code do you use to include the album in the page ?

    This one : [album id=7 template=lightbox] ?

    Thanks for your help !.


    Rom, yes, but you will need to change albumid to match your actual album id. When you say “nothing changed”, do you mean you are still getting the error? Or that the album looks the same?

    Of course I’ve change the album id… 😉

    But I still have this bloody Parse Error…

    Don’t know what to do…

    Drop me an email, it’s michael at endless poetry dot com (no dashes in the domain, one word).

    I think it comes from the theme Alive that use Ajax…

    Maybe a way here…

    Michael, this is great. THANKS!

    I have to tweak this a bit for my own needs, but this is exactly the “secret sauce” I was looking for. Thanks for sharing.


    I’ve been looking for this solution for days. Finally did the right keyword search to describe my intentions and was excited to find this solution.

    Problem is, I can’t get it to work.

    I’ve followed your instructions verbatim and end up only with ZERO gallery thumbnails and my footer and colophon disappear.

    I’m using the FancyBox enabled plugin via NextGEN Gallery Optimizer Premium. I presumed that was part of the problem, so I deactivated it. But that wasn’t the problem.

    You can see on this Album page: Portraits The original styling with the Compact Template works in conjunction with the FancyBox Plugin via NGGOptimizer.

    You can see on this Album Page: Events where I’ve changed the template to lightbox as described, the Gallery Thumbnails don’t appear, the Footer and Colophon are also missing.

    Any advice? I’d love to continue to use the FancyBox via NGGOptimizer, not the PrettyPhoto Media Plugin.


Viewing 15 replies - 1 through 15 (of 74 total)
  • The topic ‘[Plugin: NextGEN Gallery] [NextGen Gallery] Open album in lightbox’ is closed to new replies.