• 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

    https://wordpress.org/plugins/nextgen-gallery/

Viewing 1 replies (of 1 total)
  • Plugin Contributor photocrati

    (@photocrati)

    @j05hr – The tutorial and video are both for NextGEN Legacy (versions 1.19.13 and older, where templates are commonly used), I would not expect them to apply directly to the current NextGEN Gallery.

    We include the bundled Lightbox effects for convenience as standard libraries, we do not support their modification … and unfortunately we do not offer support for custom templates beyond any issue that may be due to a NextGEN Gallery item not functioning correctly within the template.

    Other than that, I am not seeing anything specifically wrong with the code change you are trying to make, in theory I would expect it to work.

    – Cais.

Viewing 1 replies (of 1 total)

The topic ‘Adding Alt or Title text to Fancybox’ is closed to new replies.