Displaying a gallery description using NextGen Gallery for Wordpress

4/03/2009

Been battling with the excellent NextGen gallery plugin for Wordpress this afternoon.

I had created an Album, which is a container for mutiple Galleries. Simple enough. But then, once you had selected a Gallery, I wanted to display the Gallery description on the Gallery page above the thumbnails.

In the Manage gallery section you can type a description, but it didn’t seem there was any way to display that on the actual website.

So if you need to, open the file gallery.php which is inside the plugins directory, nextgen-gallery/view/gallery.php

Next, above the line
<div class="ngg-galleryoverview" id="ngg-gallery-<?php echo $gallery->ID ?>">
add this:
<h2><?php echo $gallery->title; ?></h2>
<p class="gallery-desc"><?php echo nl2br($gallery->description); ?></p>

This will give you an H2 with the Gallery Title, and then the description below it.

Browse similar topics: , , ,

There are 10 comments in this article:

  1. 28/04/2009Andy says:

    HI there

    I found your blog whilst searching for help in NextGen. I’ve been battling with it too, but not getting much further, so I thought I’d be cheeky and ask your advise.
    I just do not seem to be able to link the album page with my single gallery folder photo to an actual gallery. I tried a using the “Page Link to:” in the Manage Gallery section to connect to a previously built page, but the page created is inserted into my main navbar… any ideas please..?

    Cheers from Scotland.

    Andy

  2. 30/05/2009Graphic and Web Designer says:

    Thanks so much. This worked perfectly. It would be awesome to see this in a separate plugin.

  3. 24/06/2009Bernhard says:

    thx a lot!!

  4. 12/10/2009Mat says:

    Thanks a lot! I had been trying to just lift the gallery description code from my album view template. That didn’t work, your way did!

    One thing you can also consider, which may not have been in place in the NextGen version in place when you wrote this post: You can now create your own copies of the NextGen view files, such as gallery.php, which are place in a folder called ‘nggallery’, which you create in your own theme folder.

    NextGen will now look in this folder before it looks for the plugin versions. This way, you aren’t modifying the core files & you can have your own versions as part of your theme, which will be unaffected by plugin upgrades.

    Thanks again for the code

  5. 13/10/2009Jason says:

    Thanks Mat – I wasn’t aware of that! Seems like a good addition (it may have already been there). Much better to keep hacks away from the core plugin files if you can.

  6. 28/10/2009tsabeeka says:

    wow, thanks!

  7. 17/11/2009Mike Goodstadt says:

    Great stuff!- but when I switch to slideshow it disappears…
    Where do I edit the slideshow template?
    Thanks,
    Mike

  8. 18/11/2009Andreas says:

    Thanks

    Exactly what I was looking for :)

  9. 12/01/2010Priyanka says:

    Hello Jason, Thanks. This helped me just now in a project for a client.
    @Mat:Thanks for the Suggestion.

  10. 25/01/2010Chris Billett says:

    This is excellent, thanks. It’ll be great if Alex Rabe adds this to the plugin as an option at some point, so as to not have it get overwritten during upgrades when added!