NextGEN Gallery
Any idea when the page titles can display exact album name, gallery name (2 posts)

  1. vijayrajesh
    Posted 5 years ago #


    The plugin is great one and it has no competition for it.

    I feel there are free drawbacks in the plugin. But i personally feel they are easy for a coder. I am sorry if i am not judging right.

    Ok here is the question. When the plugin will display the exact gallery name, album name and image name?

    Thank you,


  2. Thorned Rose
    Posted 5 years ago #

    You can do this and the way I read it was to alter the plugin's php however I really wouldn't recommend this unless you want to have to add the lines back in every time you update the plugin.

    How I would recommend doing it is just creating a page template specific to your gallery.

    e.g. You have album is called "Portfolio" with the gallery "Pretties" contained within. So on your Portfolio page you put the [album id=portfolio].

    Open your wordpress theme's page.php and resave it as page-portfolio.php.

    The php in question will be something like:

    <?php if (have_posts()) : ?><?php while (have_posts()) : the_post(); ?>
    <h1><?php the_title(); ?></h1>
    <?php the_content(); ?>
    <?php edit_post_link('Edit this entry.', '<p>', '</p>'); ?>
    <?php endwhile; ?>
    <?php else : ?>
    <h2>Not found!</h2>
    <p>I couldn't find the page you wanted sorry. Please use the menu above to try and find it.</p>
    <?php endif; ?>

    This will just spit out the title "Portfolio" irregardless of the album name or gallery name.

    Replace "<h1><?php the_title(); ?></h1>" just below the "<?php if (have_posts..." with this:

    <?php $album = nggdb::find_album( get_query_var('album') ); ?>
    <?php $gallery = nggdb::find_gallery( get_query_var('gallery') ); ?>
    <h1><?php echo $album->name?><?php echo " - ", $gallery->title?></h1>

    The first two lines get the names of the album and gallery. The php between the <h1> tags spits it out so it will look like "Album Name" - "Gallery Name" or in the case of our example Portfolio - Pretties.

    Also, you can change the "-" to whatever you want or omit it entirely by removing the " - ", part (i.e. <?php echo $gallery->title?>)

    These are interchangeable and you can put them where ever you want on the page.

    Hope this helps! :)

Topic Closed

This topic has been closed to new replies.

About this Plugin

  • NextGEN Gallery
  • Frequently Asked Questions
  • Support Threads
  • Reviews

About this Topic


No tags yet.