How to Display NextGen Gallery Names/Titles within Albums

The NextGen Gallery is an awesome WordPress plugin and for good reason: it’s the best for displaying large numbers of pictures in an organized, appealing and user friendly fashion. While this plugin handles a large number of configurations out of the box (such as various viewing effect, slide show modes, and more) you may still have a need to tweak a few things to get exactly what you want done. In this instance we will be displaying a gallery’s title within an album.

NextGen Acts Like This Out-of-the-box

I have an album (collection of galleries) on my WordPress page and it looks like this when I navigate to it:
My Album Out of the Box

When I click on a Gallery in the list I am taken to the gallery listing all the images and pagination if you have a lot of them. No Gallery Titles

This is all fine, but where’s my NextGen gallery title? And also, how’s the user supposed to get back to the top-level? Surely they’re not going to be forced to use the back button!? Not if you do what I have laid-out below… let’s check it out.

Open up the appropriate NextGen files to get started

First navigate to our plugins directory (wp-content/plugins) and open up NextGen gallery > View > “gallery.php”
Open NextGen gallery.php

Add the Gallery’s name Variable to Gallery.php

Now that we have the gallery.php file open let’s add this bit of code to line 16:


Here’s an image showing where I added it to my file:
Add the gallery name variable here

Echo the Gallery Name Variable in Gallery.php

Now that we have the appropriate variable ready for us, let’s go it and show it on our galleries.

Add the following code to line 21 after the div with the class “ngg-galleryoverview”.

name?>

This will output the Gallery’s name above the pictures. Also in an H2 tag for SEO benefits. Check out this picture showing what I see now when I view a gallery within my NextGen Album:
NextGen Gallery with Title

Bonus: Add a back button to the Gallery

It’s nice that we have a title now, but what is the user wants to go back to the album page? Let’s put in a back button on gallery-carousel.php to increase the user experience.

Add the following to gallery.php right below the bit of code we added in the step above:

« Back to Album

NextGen Gallery with Back Link

Final Thoughts on our NextGen Modifications

Since we are modifying the NextGen view files there’s a chance that our changes will be overwritten when upgrading this plugin. I’m not sure if these files are left alone during upgrade or not, so be sure to backup your files.

Here’s a thread that got me started on modifying the NextGen views for increased user experience and SEO benefits. http://wordpress.org/support/topic/284710