WordPress.org

Ready to get started?Download WordPress

Forums

NextGEN Gallery
How to add navigation within the Album or Gallery (14 posts)

  1. heasousa
    Member
    Posted 4 years ago #

    Hi,

    I installed the nextgen gallery yesterday and I am enjoying it a lot - very easy to use.
    However, I am not getting how to add a navigation along the pages of an album or a gallery. Something like:

    Album >> Gallery >> Photos

    When I click on the album, I go the gallery, but then I loose track on how to go back to the album (there isn't a navigation between them - I have to use the back button of the browser). I would like to add something like the navigation I have above, so that I could always know where I am within my album structure and so that it will be easy to comeback to the first page of the album.

    Can somebody help me to set this up?
    (I am not a technical person, so please make it simpler for me)

    Thank you very very much!
    Best regards,
    Helena

  2. KuroTsuto
    Member
    Posted 4 years ago #

    I am rather interested in this topic myself! I believe I read something about using custom gallery templates, somewhere, but now I cannot seem to find it again...

  3. Buddha23
    Member
    Posted 4 years ago #

    Go to manage gallery on your left collumn....then go to create a new page. It should auto generate a button for that gallery. Good Luck!

  4. alambertj
    Member
    Posted 4 years ago #

    They aren't talking about a button for the gallery, they're talking about a breadcrumb navigation within the gallery so you don't have to use the browser's back button to get back out of the gallery.

    I'm also annoyed with the lack of navigation on NextGEN. I'm looking through the PHP files in the plugin editor, but I don't know enough about PHP to know where to even start. The only immediate solution I thought of was to put a hard-coded navigation in the page itself.

    If anyone has any insight about this issue, it would be very helpful.

  5. heasousa
    Member
    Posted 4 years ago #

    Thanks for explaining. That is really what I want. It seems such a basic functionality that I thought it should be turned on in some of the options, but apparently I am not the only one who didn't find it... :-(

    I also thought about adding the navigation myself, but that is really a lot of work when you have a big album!... And this is such an essential feature that it is hard to make the choice for this gallery without it!

    If anyone finds a solution, please post! I really like everything else about this album!...
    Thanks Helena

  6. audioel
    Member
    Posted 3 years ago #

    I have a very convoluted way of doing this right now, but it works fine as long as you navigate to the gallery from an album. I'm sure there's a much easier, elegant way of doing this. :)

    Does anyone have any idea how to pull $album into the gallery template? I'm doing this right now:

    $album = nggdb::find_album( get_query_var('album') );

    And it only seems to grab it when you navigate from an album.

    <?php
    /* create album navigation */
    $slug = basename(get_permalink());
     $galleries = array();
        $query = "SELECT * FROM <code>wp_ngg_gallery</code> ORDER BY <code>wp_ngg_gallery</code>.<code>gid</code> ASC";
            $result = mysql_query($query) or die(mysql_error()); ?>
    
    <div class="gallery_navigation">   
    
    <?php    /* create array with results keyed by gid */
        while($row = mysql_fetch_array($result)){
            $galleries[$row['gid']]  = stripslashes($row['title']);
        };
        /* build links for galleries */
        foreach ( $album->gallery_ids as $gals ) {
        $nav .= '<li class="menu-item"><a href="'.get_bloginfo('url').'/photo-galleries/'.$slug.'/?album='.$album->id.'&gallery='.$gals.'">'.$galleries[$gals].'</a></li>';
        };
    ?>
    
    <ul class="menu">
    <li class="title"><?php echo $album->name.":"; ?></li>
    <?php echo $nav; ?>
    </ul>
    
    <script>
    // add current location to gallery navigation
    
    jQuery(window).load(
        function() {
            jQuery("ul.menu li.menu-item:contains('<?php echo $gallery->title; ?>')").addClass("current");
        }
    );
    </script>
    
    </div> <!-- end gallery navigation -->

    Thanks,

    Gustavo

  7. mfro
    Member
    Posted 3 years ago #

    I'm trying to figure out this functionality as well. It seems essential.

    Gustavo -- what file do I put your code in and where does it go?

    thanks!

  8. audioel
    Member
    Posted 3 years ago #

    Mfro - it goes in gallery.php. However, please keep in mind that the code as above doesn't work 100% - it only works when you're navigating to a gallery from an album, embedded in the same page.

    I may have a much better solution soon - but I'm under deadline right now, so it will take me a little bit to post. :)

  9. Axelf78
    Member
    Posted 3 years ago #

    It's amazing this plugin is lacking this most basic functionality. i get many complaints from customer asking how to get back to the album page once they have clicked on the gallery. It sort of just drops you on the gallery page with no way to get back without hitting the browser back button. Must be fixed.

  10. salocined
    Member
    Posted 3 years ago #

    breadcrumb needed indeed

  11. salocined
    Member
    Posted 3 years ago #

    I am going to post my solution, temporary but does the job.

    1/ Select the gallery id from the url

    $thecurrentalbum = $_GET["album"];
    $thecurrentgallery = $_GET["gallery"];
    if($thecurrentgallery!=""){
    $query = "SELECT * FROM wp_ngg_gallery where gid=".$thecurrentgallery;
    $result = mysql_query($query) or die(mysql_error());
    while($row = mysql_fetch_array($result)){
         $currentgallerytitle  = stripslashes($row['title']);
         $currentgallerydesc  = stripslashes($row['galdesc']);
    };
    }

    2/ Then display the info a simple javascript history back

    <?if($thecurrentgallery!=""){?>
      <div class="gallery_navigation">
      <b>Gallery Title:</b> <?php echo $currentgallerytitle;?><br />
      <b>Description:</b> <?php echo $currentgallerydesc;?><br />
      <a href="javascript:history.back();">Go back to the Album</a>
      <?php the_content(); ?>
      </div>
      <?}?>
  12. Marklcm
    Member
    Posted 3 years ago #

    could you elaborate where to use this code please
    Much appreciated

  13. salocined
    Member
    Posted 3 years ago #

    what exactly do you need marklcm?

    Create a specific template for your galleries and use the code

  14. Marklcm
    Member
    Posted 3 years ago #

    Thanks for quick reply. I'm new to this but was just reading up about creating templates,but am a bit in the dark. Could I paste your code into the top? body? foot? of existing gallery.php & save as 'gallery-new version.php' and put it in the folder nggallery

Topic Closed

This topic has been closed to new replies.

About this Plugin

About this Topic

Tags

No tags yet.