Displaying a gallery description using NextGen Gallery for WordPress

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.

Advertisements

10 thoughts on “Displaying a gallery description using NextGen Gallery for WordPress

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

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

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s