WordPress.org

Ready to get started?Download WordPress

Forums

[resolved] [Plugin: NextGEN Gallery] How to get gallery titles to show? (8 posts)

  1. maisteriharju
    Member
    Posted 5 years ago #

    Hi,

    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?

    Thanks!

    - T -

  2. maisteriharju
    Member
    Posted 5 years ago #

    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');'

    add

    $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 -

  3. erzlager
    Member
    Posted 5 years ago #

    Hello,

    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.

  4. bcreighton
    Member
    Posted 5 years ago #

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

    ~thanks! :)

  5. cinematic
    Member
    Posted 5 years ago #

    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.

  6. bcreighton
    Member
    Posted 5 years ago #

    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.

  7. hazyd
    Member
    Posted 5 years ago #

    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.

  8. timjamz
    Member
    Posted 5 years ago #

    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!

Topic Closed

This topic has been closed to new replies.

About this Topic

Tags

No tags yet.