Wednesday, March 4, 2009

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.

9 comments:

  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

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

    ReplyDelete
  3. 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.

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

    ReplyDelete
  5. Thanks

    Exactly what I was looking for :)

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

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

    ReplyDelete