Support » Plugins » [Plugin: NextGEN Gallery] How to get gallery titles to show?

  • Resolved maisteriharju



    When I open gallery, I can see the thumbnails but there is no title of the gallery. Is it possible to get the title of the gallery show as well?


    – T –

Viewing 7 replies - 1 through 7 (of 7 total)
  • I figured it out by myself.

    If someone needs to know, here is how I did it. But words of warning at first. I don’t know anything about php. I just tried things and eventually it worked out. So if something goes wrong with your gallery, pls don’t blame me.

    Here is tutorial.

    1. Open nggfunctions.php to your text editor
    2. Find the place where it says “function nggCreateGallery”
    3. Few lines below it says

    global $nggRewrite;

    Change it to

    global $wpdb, $nggRewrite;

    4. After

    ‘$ngg_options = nggallery::get_option(‘ngg_options’);’


    $galleryID = $wpdb->escape($galleryID);
    $gallerycontent = $wpdb->get_row("SELECT * FROM $wpdb->nggallery WHERE gid = '$galleryID' ");

    5. Find

    if (is_array($picturelist)) {
    $out ='<div class=”ngg-galleryoverview” id=”ngg-gallery-‘. $galleryID .'”>’;

    and add in the middle

    <font style="color:#fff">'.$gallerycontent->title.'</font>

    so that it looks like this:

    if (is_array($picturelist)) {
    $out  = '<font style="color:#fff">'.$gallerycontent->title.'</font><div class="ngg-galleryoverview" id="ngg-gallery-'. $galleryID .'">';

    6. Save the changes.

    You can change to font color/styling to fit your website design. The title of the gallery should now show up on the top of your gallery thumbnails. If it doesn’t show up, or something goes wrong, don’t ask me because I honestly don’t have the faintest idea how it works. This all is just trial and error to me.

    – T –


    as i faced the same problem i found this tutorial fortunately and am very thankful about it.

    I tried it, it works, and i have further (tested and working) suggestions. They all deal with the code snippet to be added under point 5.

    I replaced the depriciated <font>-tag with a semantical senseful <h3> and added the galery description within <p>-Tags plus a <hr /> which is optional of course.

    The fragment in complete is like so:

    if (is_array($picturelist)) {
    $out  = '<h3>Galery: '.$gallerycontent->title.'</h3><p>'.$gallerycontent->galdesc.'</p><hr /><div class="ngg-galleryoverview" id="ngg-gallery-'. $galleryID .'">';

    I would suppose the (X)HTML code inserted is completely up to you; the deciding pieces are the tags included by the dots and therefore the most valuable information.

    Although i estimate this as a great improvement i should mention that i miss the existence of a “back to album”-button because many users will be disorientated by the lack of any information like that.
    But at the moment i don’t have neither enough time nor knowledge to implement this, so it may be good enough for the time being.

    Furthermore a plugin core hack is never a good solution. Hopefully these necessities/possibilities will be included in future versions.

    Alex Rabe – could we get this implemented in future versions of the plugin? It seems like a pretty common request.

    ~thanks! 🙂

    I am not sure if it would be a good idea to have a title implemented by standard. I think it is less work to manually add the title than removing it if you don’t want it .. for example if you have assigned the gallery to a page and the page title is the title of the gallery. Then you would have the title twice.

    There could be some logic worked in that says “if this is a page = no title), otherwise show title. Having to change the code with every update is a pain. As of right now, I have to change the little pagination arrows with each update because they don’t work on a Mac.

    I’ve made the edits as you’ve shown here and I’m still not getting my gallery titles to show. I’d really like this to be an option to display in the next release.

    Don’t know what version you may be using, but I found this isn’t so difficult. In the latest version of this plugin, I simply edited view/gallery.php near the top — changed this line:

    <div class="ngg-galleryoverview" id="ngg-gallery-<?php echo $gallery->ID ?>">

    to this:

    <h3><?php echo $gallery->title; ?></h3><div class="ngg-galleryoverview" id="ngg-gallery-<?php echo $gallery->ID ?>">

    Notice the $gallery->title… looks like you don’t have to global the database, query the database, create a new variable or anything.

    Hope this helps!

Viewing 7 replies - 1 through 7 (of 7 total)
  • The topic ‘[Plugin: NextGEN Gallery] How to get gallery titles to show?’ is closed to new replies.