WordPress.org

Ready to get started?Download WordPress

Forums

NextGEN Gallery
[resolved] [closed] [NextGen Gallery] Open album in lightbox (75 posts)

  1. mvandemar
    Member
    Posted 1 year ago #

    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:

    http://pastebin.com/XW9H9ud6

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

    http://pastebin.com/rqV0JZU0

    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:

    http://wordpress.org/extend/plugins/prettyphoto-media/

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

    rel="prettyPhoto[%GALLERY_NAME%]"

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

    -Michael

    http://wordpress.org/extend/plugins/nextgen-gallery/

  2. Romain VINCENT
    Member
    Posted 1 year ago #

    Hi,

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

    Thanks a lot for your job.

    R.

  3. mvandemar
    Member
    Posted 1 year ago #

    @Romainvincent - Sure, it's here:

    http://www.simivalleysdentist.com/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.

    -Michael

  4. Romain VINCENT
    Member
    Posted 1 year ago #

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

  5. seanchk
    Member
    Posted 1 year ago #

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

    Sean

  6. Romain VINCENT
    Member
    Posted 1 year ago #

    Re-Hi,

    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

  7. mvandemar
    Member
    Posted 1 year ago #

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

  8. Romain VINCENT
    Member
    Posted 1 year ago #

    Voilà :

    http://pastebin.com/7Wuw1SM5

    But it's exactly the same as you posted (I think...)

  9. mvandemar
    Member
    Posted 1 year ago #

    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:

    http://php.net/manual/en/security.magicquotes.disabling.php

    See if that helps.

  10. Romain VINCENT
    Member
    Posted 1 year ago #

    Hi,

    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 !.

    R.

  11. mvandemar
    Member
    Posted 1 year ago #

    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?

  12. Romain VINCENT
    Member
    Posted 1 year ago #

    Of course I've change the album id... ;-)

    But I still have this bloody Parse Error...

    Don't know what to do...

  13. mvandemar
    Member
    Posted 1 year ago #

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

  14. Romain VINCENT
    Member
    Posted 1 year ago #

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

    Maybe a way here...

  15. napsfan
    Member
    Posted 1 year ago #

    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.

  16. melissa.r.mercado
    Member
    Posted 1 year ago #

    Hi!

    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.

    Thanks,
    Melissa

  17. mvandemar
    Member
    Posted 1 year ago #

    @melissa, the page is erroring out from what I can tell, and dying halfway through without outputting the error though. Is there an error_log in the theme directory? Feel free to drop me an email (my email addy is a few posts up) if you want more help.

  18. melissa.r.mercado
    Member
    Posted 1 year ago #

    @mvandemar - Thanks for being available. I've just sent you an email.

  19. mvandemar
    Member
    Posted 1 year ago #

    Just so others know, the nggGetGallery() function needs to be added to the functions.php inside of the theme, and if you use a lightbox other than PrettyPhoto then you will need to adjust this step accordingly to match whatever code that lightbox package is expecting:

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

    rel="prettyPhoto[%GALLERY_NAME%]"

  20. cdmuench
    Member
    Posted 1 year ago #

    THANK YOU!

  21. bunnie123
    Member
    Posted 1 year ago #

    Thank you!!! Great job!!!

  22. inMotionGraphics
    Member
    Posted 1 year ago #

    @mvandemar You are a legend mate! I have been battling for hours to figure out how to get NGG working together with Pretty Photo Media, and your solution inspired me to try one last thing... and it worked!

    I didn’t create all the extra files, functions and templates etc. All I did was add the following code (thanks to you) as a custom effect, just like you suggest here:

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

    rel="prettyPhoto[%GALLERY_NAME%]"

    The result is exactly this:

    http://www.inmotionkitesurfing.com/photos

    So to anyone looking for a quick, easy solution, just install PrettyPhoto Media as @mvandemar suggests, then add the above code to NGG Gallery as he suggests as well. And that should be it...

    Thanks @mvandemar for taking the time to share your solution with us, and in the process, sorting out my problem for me.

    Brendon

  23. nfdieter
    Member
    Posted 1 year ago #

    @Brendon

    now i like the Next Gen Gallery
    Thank you

    Dieter

  24. 2nu2no
    Member
    Posted 1 year ago #

    Serious thanks for this. The clarification about using the functions.php in the theme (not the functions.php in the nextgen-gallery/admin, where I initially went) made all the difference. You are a prince, sir!

  25. schleusse
    Member
    Posted 1 year ago #

    Works like a charm, thanks a lot for this! Question from a WP newb: Why can't the nggGetGallery function reside in the album-lightbox.php file? This would avoid tainting my theme (Origin in this case)..

  26. seozones
    Member
    Posted 1 year ago #

    Hi there. I got this to work, thanks!!

    I also own the Foobox plugin. Do you know if a hack will work using that plugin?

  27. bradvin
    Member
    Posted 1 year ago #

    Hi there

    We have put together a post on how to do this with Foobox : http://getfoobox.com/open-a-nextgen-gallery-album-in-foobox-from-the-album-cover/

  28. steffy65
    Member
    Posted 1 year ago #

    Hello,

    Total newbie here.. I am trying to do the above (that is click on one photo that then takes me to the album and comes up in the lightbox.

    I have installed the prettyphoto plugin, amended the code in nextgen, as per "inMotionGraphics" instructions. Is that all I need to do? I am quite confused with all the other instructions.

    I get the following error: Rendering of template album.php failed.
    This is the shortcode I am using: [album id=6 template=lightbox].

    Am i missing a step.

    Any help would be greatly appreciated.

    stephanie

  29. mvandemar
    Member
    Posted 1 year ago #

    I have installed the prettyphoto plugin, amended the code in nextgen, as per "inMotionGraphics" instructions. Is that all I need to do?

    @steffy65 - while they may be confusing, the other instructions in my first post, namely creating the supporting function in functions.php and creating the new template, are necessary to get it working.

    -Michael

  30. steffy65
    Member
    Posted 1 year ago #

    Thanks Michael,

    Thought that there was more to it (sadly). Now I am completely out of my depth as I don't know how to do either of those; as I said previously, complete noob here... a bit of css is my experience so far ;)

    I am using the Esplanade theme.. any help would be sooo appreciated as I really like the look of this function.

    cheers

    Stephanie

Topic Closed

This topic has been closed to new replies.

About this Plugin

About this Topic