Adding Alt or Title text to Fancybox
-
Hi
I posted this in the main how to and troubleshooting forum but got not answer so thought I’d come ask the main man himself.
I’m using lightbox as a gallery. It’s customised a bit so when you click on a thumbnail, it opens Fancybox and you can scroll through the images in the gallery.
It was done using this tutorial
http://www.bentedder.com/nextgen-gallery-load-lightbox-gallery-from-one-image/
And this is the code from it
<?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)) : ?> <?php $i=1; ?> <div class="gallery-holder gal<?php echo $gallery->ID; ?>"> <?php foreach ($images as $image) : ?> <?php if ($i < 2) : ?> <div style="display:none;"> <img src="<?php echo $image->imageURL ?>" /> </div> <a href="<?php echo $image->imageURL ?>" <?php echo $image->thumbcode ?> title="<?php echo $gallery->title ?>"> <img src="<?php echo $image->thumbnailURL ?>" /></a> <?php else : ?> <a style="display:none" href="<?php echo $image->imageURL ?>" <?php echo $image->thumbcode ?>>link</a> <?php endif; $i++; ?> <?php endforeach; ?> </div>If I change out the line
<a href="<?php echo $image->imageURL ?>" <?php echo $image->thumbcode ?> title="<?php echo $gallery->title ?>">for
<a href="<?php echo $image->imageURL ?>" title="<?php echo $image->alttext ?>" <?php echo $image->thumbcode ?> >But then it only displays the alt text/title for the first image in the gallery. I guess it needs some sort of loop to make it work for every image but my PHP knowledge is very limited.
Got any ideas?
Thanks
Josh
The topic ‘Adding Alt or Title text to Fancybox’ is closed to new replies.