[ Moderator Note: Please post code or markup snippets between backticks or use the code button. Or better still – use the pastebin ]
I used the plugin to create a gallery with links pointing to an external page.
https://www.ilmetauro.it/sfogliagiornale
I had to insert some code to choose to see simply an image (if it has no custom fields) or to link to the page (if link is present in each image of the gallery. It worked fine, but today I have upgraded NGGallery to the last version, my code has been overwritten by the new gallery.php and now I tried so many times to add my code again, but I see a normal image, but my gallery images don’t point to external links anymore. Is there something going wrong with last NGG pllugin? How to add my code in gallery.php? This is my code:
<?php
/**
Template Page for the gallery overview
Follow variables are useable :
$gallery : Contain all about the gallery
$images : Contain all images, path, title
$pagination : Contain the pagination content
You can check the content when you insert the tag <?php var_dump($variable) ?>
If you would like to show the timestamp of the image ,you can use <?php echo $exif['created_timestamp'] ?>
**/
?>
<?php if (!defined ('ABSPATH')) die ('No direct access allowed'); ?><?php if (!empty ($gallery)) : ?>
<div class="ngg-galleryoverview" id="<?php echo $gallery->anchor ?>">
<?php if ($gallery->show_slideshow) { ?>
<!-- Slideshow link -->
<div class="slideshowlink">
</a><a>slideshow_link ?>">
<?php echo $gallery->slideshow_link_text ?>
</a>
</div>
<?php } ?>
<?php if ($gallery->show_piclens) { ?>
<!-- Piclense link -->
<div class="piclenselink">
<a>piclens_link ?>">
<?php _e('[View with PicLens]','nggallery'); ?>
</a>
</div>
<?php } ?>
<!-- Thumbnails -->
<?php foreach ( $images as $image ) : ?>
<div id="ngg-image-<?php echo $image->pid ?>" class="ngg-gallery-thumbnail-box" <?php echo $image->style ?> >
<div class="ngg-gallery-thumbnail" >
<!-- se si vuole linkare alla foto grande mantenere solo il rpimo 'href=' altrimenti se si vuole linkare il link personalizzato mantenere solo il secondo 'href=' -->
<?php
if ($image -> ngg_custom_fields ['link']=="") {
?>
<a>imageURL ?>" title="<?php echo $image->description ?>" <?php echo $image->thumbcode ?> rel="lightbox[<?php echo $gallery->anchor; ?>]">
<?php
} else {
?>
</a><a> ngg_custom_fields ['link'] ; ?>" target=_blank title="<?php echo $image->description ?>"
<?php echo $image -> thumbcode ?> >
<?php
}
?>
<?php if ( !$image->hidden ) { ?>
<img title="<?php echo $image->alttext ?>" alt="<?php echo $image->alttext ?>" src="<?php echo $image->thumbnailURL ?>" <?php echo $image->size ?> />
<?php } ?>
</a>
</div>
</div>
<?php if ( $image->hidden ) continue; ?>
<?php if ( $gallery->columns > 0 && ++$i % $gallery->columns == 0 ) { ?>
<br style="clear: both" />
<?php } ?>
<?php endforeach; ?>
<!-- Pagination -->
<?php echo $pagination ?>
</div>
<?php endif; ?>