eloymedia
Member
Posted 3 years ago #
I am playing around with NextGen Gallery and I created an album with a few galleries in it. I am sure you have heard about this "issue" before. I am trying to figure out a way to get a back-to-link to the album.
Something like Alex has here:
http://nextgen.boelinger.com/nggallery/page-107/tags/wordpress/
The Overview link to go back is what i am looking for. Any suggestions would be welcome.
particulartastes
Member
Posted 3 years ago #
I'd love to know as well...
This is what I have on my gallery pages. Open up page.php and look for this:
<?php the_content(); ?>
Just above it paste following code (after you filled in the ID and the URL):
<?php global $post;
if ($post->post_parent == ENTER HERE THE ID OF THE OVERVIEW PAGE){ ?>
<p>
<a href="ENTER THE URL OF THE OVERVIEW PAGE"><?php _e('<< Back to gallery overview') ?></a>
</p>
<?php } ?>
This code depends on every gallery page being a child page of the gallery overview page.
Of course, now that we have templates you can add something similar to gallery.php in the nggallery folder you copied into your theme folder. This would make more sense.
Xspringe
Member
Posted 3 years ago #
Can anyone confirm that this still works? I can't seem to get it right and it won't display the link. However, if I manually go to "edit page" and set the parent ID of the album page to a random page with a known ID, the back link will be displayed (but on both the album and gallery pages).
I'm sure that I have the correct ID of the gallery page (I checked for it using themouseover technique). I'm running WP 2.7 with permalinks enabled and NextGEN 1.2.1.
FotoAndy
Member
Posted 2 years ago #
Thanks for this, came in very useful, and I learned some new php today! :)
(...and for Xspringe, using WP 2.8, latest NextGEN from October 2009 with no problems.)
alleyoopster
Member
Posted 2 years ago #
The link is not showing up for me. Can anyone see the problem? Thanks
<?php get_header(); ?>
<div id="content" class="narrowcolumn">
<?php if (have_posts()) : while (have_posts()) : the_post(); ?>
<div class="post-page" id="post-<?php the_ID(); ?>">
<h2 class="page_title"><?php the_title(); ?></h2>
<div class="entry entry_page">
<?php global $post;
if ($post->post_parent == 53){ ?>
<p>
<a href="http://holidays.letang.info/?page_id=53"><?php _e('<< Back to gallery overview') ?></a>
</p>
<?php } ?>
<?php the_content('<p class="serif">Read the rest of this page »</p>'); ?>
<?php wp_link_pages(array('before' => '<p><strong>Pages:</strong> ', 'after' => '</p>', 'next_or_number' => 'number')); ?>
<?php edit_post_link('Edit this entry.', '<br /><p>', '</p>'); ?>
</div>
</div>
<?php endwhile; endif; ?>
</div>
<?php get_footer(); ?>
tomboersma
Member
Posted 2 years ago #
the second line is missing the '' around the 53. Correct is:
if ($post->post_parent == '53'){ ?>
Another important detail is that you need to have your galleries on their own (sub)pages.