I create a new gallery template, inside my theme folder is the folder /nggallery/gallery-slide.php, here I create a link for the images using the ID of the “Page link to”
<a href="<?php bloginfo('url'); ?>/?p=<?php echo $gallery->pageid ?>">
it works, but is not exaclty what I need.
If you want all images link to the “Page link to”, but in my case is not. I use NGG Custom Fields Plugin, resolving the link and gallery like this:
<?php if (!defined ('ABSPATH')) die ('No direct access allowed'); ?><?php if (!empty ($gallery)) : ?>
<div id="hotel-slider">
<?php foreach ( $images as $image ) : ?>
<div data-caption="#htmlCaption-<?php echo $image->pid ?>">
<a href="<?php echo $image->ngg_custom_fields["Link"]; ?>">
<img title="<?php echo $image->alttext ?>" alt="<?php echo $image->alttext ?>" src="<?php echo $image->imageURL ?>" />
</a>
</div>
<?php endforeach; ?>
</div>
<?php foreach ( $images as $image ) : ?>
<div class="orbit-caption" id="htmlCaption-<?php echo $image->pid ?>">
<?php echo $image->alttext ?>
</div>
<?php endforeach; ?>
<?php endif; ?>
and I insert the gallery using the shortcode inside the theme code:
<?php if ( get_post_meta( get_the_ID(), '_ola_hotel_gallery', true) ): ?>
<?php echo do_shortcode('[nggallery id='.get_post_meta( get_the_ID(), '_ola_hotel_gallery',true ).' template=slide]');?>
<?php endif; ?>
My PHP/MySQL skills are limited so I don′t know how to use <?php echo $gallery->pageid ?>
outside the new NGG template file.