WordPress Version: 3.3.1
NextGEN Gallery Version: 1.9.3
Plugin Author: http://alexrabe.de/wordpress-plugins/nextgen-gallery/

NextGEN Gallery [nggallery id=x template=caption] Bug

See the NextGen Caption Bug post for details of this problem and its impact.

NextGEN Gallery [nggallery id=x template=caption] Fix

The problem occurs in a number of NextGen programs including /view/gallery-caption.php, /view/singlepic/php and /widgets/widgets.php.

The ‘must change’ two for me are /view/gallery-caption.php and /view/singlepic/php as they caused visual problem with my Nextgen galleries.

I haven’t provided a fix to /widgets/widgets.php as the only impact from that I’ve noticed is puttng lots of junk into my page source. I’m trying to keep my customising to a minimum so that one can stay.

Basically the fix requires occurrences of the variables ‘description’, ‘caption’ and ‘linktitle’ to be changed to ‘alttext’ whenever they are used as titles and alt text in <href> or <img> statements. I first made these changes a long time ago and from memory had 404 errors occur when viewing the gallery (although I may have also may other changes at the same time). Either way, updating permalinks resolved that.

Here’s before and after screen caps to show what a difference the changes below made.

NextGen Template Caption Shortcode - Default Web Page Layout

NextGen Template Caption Shortcode - Default Web Page Layout

NextGen Template Caption Shortcode - Updated Page Layout

NextGen Template Caption Shortcode - Updated Page Layout

The following code was run through a converter to allow it to be viewed as text on this page – hopefully the syntax is still correct. Between the two programs I only changed three words so personally I would change those manually rather than cut/paste the whole snippet.

Nextgen Gallery /view/gallery-caption.php

Original
<div class="ngg-gallery-thumbnail" >
<a href="<?php echo $image->imageURL ?>" title="<?php echo $image->description ?>" <?php echo $image->thumbcode ?> >
<?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>
<span><?php echo $image->caption ?></span>
</div>

Updated
<div class="ngg-gallery-thumbnail">
<a href="<?php echo $image->imageURL ?>" title="<?php echo $image->alttext ?>" <?php echo $image->thumbcode ?> >
<?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>
<span><?php echo $image->alttext ?></span>
</div>

Nextgen Gallery /view/singlepic.php

Original
<a href="<?php echo $image->imageURL ?>" title="<?php echo $image->linktitle ?>" <?php echo $image->thumbcode ?> >

Updated
<a href="<?php echo $image->imageURL ?>" title="<?php echo $image->alttext ?>" <?php echo $image->thumbcode ?> >