[Plugin: NextGEN Gallery] Gallery title and Back-link hack
-
Unfortunately when using Nextgen Gallery and browsing sub-albums a user doesn’t really know in which album they are in a simple manor and if for example they get a link directly to a gallery from a friend where the gallery is a child page of an album they have no way of easily returning to the Nextgen Album root (like https://www.YOUR-URL.com/gallery).
This hack takes care of that problem in a simple manor by editing functions.php;
1. Open nextgen-gallery/functions.php
2. Find line 315 & 316:if (is_array($picturelist)) { $out = '<div class="ngg-galleryoverview" id="ngg-gallery-'. $galleryID .'">';
3. Give it the finger and replace with;
///////////////////////////////////////////////////////////////////////////////////////////////////////////// begin ugly hack global $wpdb, $nggRewrite; $ngg_options = nggallery::get_option('ngg_options'); $galleryID = $wpdb->escape($galleryID); $gallerycontent = $wpdb->get_row("SELECT * FROM $wpdb->nggallery WHERE gid = '$galleryID' "); // choose between variable and page link if ($ngg_options['galNoPages']) { $args['album'] = $albumID; $args['gallery'] = $galleryID; $link = $nggRewrite->get_permalink($args); } else { $link = get_permalink($gallerycontent->pageid); } if (is_array($picturelist)) { $out = ' <h2 class="gallerytitle">'. $gallerycontent->title .'</h2> <a>YOUR-WP-GALLERY-SUBPAGE" class="arrowleft">Go back</a> <div class="ngg-galleryoverview" id="ngg-gallery-'. $galleryID .'"> '; ////////////////////////////////////////////////////////////////////////////////////////////////////////////// end ugly hack
4. Change “YOUR-WP-GALLERY-SUBPAGE” with the url of your Nextgen Album-page (like ./gallery if you have WordPress in your root directory and your gallery in https://www.YOUR-URL.com/gallery)
Optional
5. Apply styling to the link with the class “arrowleft” or just edit/add a class in any way you want.
6. Apply styling to the h2 with the class “gallerytitle” in order to make it look better or change the class or heading to whatever you want. It’s simple html.Good luck and make sure to have backups of your original functions.php! Also be aware of that if you upgrade nextgen gallery this hack will be long gone.
Also have in mind that i just share this so that others that wants the same output can have it, my PHP-coding skills aren’t really there but this will still take care of the job even if it takes some editing in the core of Nextgen Gallery. ??
https://www.ads-software.com/extend/plugins/nextgen-gallery/
- The topic ‘[Plugin: NextGEN Gallery] Gallery title and Back-link hack’ is closed to new replies.