[Plugin: NextGEN Gallery] show Title alt of image instead

 

view/gallery.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" >
<?php echo $image->alttext ?>
<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>
</div>
</div>

----------------------------------------------------------------------

In the nextgen plugin dir, edit the file view/gallery.php.

Find the line of code for the anchor (link) around the thumbnail:

<a href="/<?php echo $image->imageURL ?>" title="<?php echo $image->description ?>" <?php echo $image->thumbcode ?> >

Replace the title attribute with:
<?php echo $image->alttext ?>

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

Explanation: The effects like the Shutter box use the anchor title attribute to display text under the image. NextGen defaults this to the description field, but the edit above will replace this default with the alttext field.

Hope that helps!


( ! ) Warning: count(): Parameter must be an array or an object that implements Countable in /var/www/vhosts/shan.info/httpdocs/templates/gk_publisher/html/com_k2/templates/default/item.php on line 169
Call Stack
#TimeMemoryFunctionLocation
10.0018412168{main}( ).../index.php:0
20.21714262184Joomla\CMS\Application\SiteApplication->execute( ).../index.php:49
30.21714262184Joomla\CMS\Application\SiteApplication->doExecute( ).../CMSApplication.php:196
40.694111452976Joomla\CMS\Application\SiteApplication->dispatch( ).../SiteApplication.php:233
50.695211477352Joomla\CMS\Component\ComponentHelper::renderComponent( ).../SiteApplication.php:194
60.697111532680Joomla\CMS\Component\ComponentHelper::executeComponent( ).../ComponentHelper.php:377
70.698011560080require_once( '/var/www/vhosts/shan.info/httpdocs/components/com_k2/k2.php' ).../ComponentHelper.php:402
80.714211959712K2ControllerItem->execute( ).../k2.php:64
90.714211959712K2ControllerItem->display( ).../BaseController.php:710
100.749912610416K2ControllerItem->display( ).../item.php:78
110.749912610416K2ControllerItem->display( ).../controller.php:19
120.758712981456Joomla\CMS\Cache\Controller\ViewController->get( ).../BaseController.php:663
130.761113001824K2ViewItem->display( ).../ViewController.php:102
140.875515870760K2ViewItem->display( ).../view.html.php:742
150.875515870760K2ViewItem->loadTemplate( ).../HtmlView.php:230
160.879316043696include( '/var/www/vhosts/shan.info/httpdocs/templates/gk_publisher/html/com_k2/templates/default/item.php' ).../HtmlView.php:701

( ! ) Notice: Only variables should be assigned by reference in /var/www/vhosts/shan.info/httpdocs/templates/gk_publisher/html/com_k2/templates/default/item.php on line 478
Call Stack
#TimeMemoryFunctionLocation
10.0018412168{main}( ).../index.php:0
20.21714262184Joomla\CMS\Application\SiteApplication->execute( ).../index.php:49
30.21714262184Joomla\CMS\Application\SiteApplication->doExecute( ).../CMSApplication.php:196
40.694111452976Joomla\CMS\Application\SiteApplication->dispatch( ).../SiteApplication.php:233
50.695211477352Joomla\CMS\Component\ComponentHelper::renderComponent( ).../SiteApplication.php:194
60.697111532680Joomla\CMS\Component\ComponentHelper::executeComponent( ).../ComponentHelper.php:377
70.698011560080require_once( '/var/www/vhosts/shan.info/httpdocs/components/com_k2/k2.php' ).../ComponentHelper.php:402
80.714211959712K2ControllerItem->execute( ).../k2.php:64
90.714211959712K2ControllerItem->display( ).../BaseController.php:710
100.749912610416K2ControllerItem->display( ).../item.php:78
110.749912610416K2ControllerItem->display( ).../controller.php:19
120.758712981456Joomla\CMS\Cache\Controller\ViewController->get( ).../BaseController.php:663
130.761113001824K2ViewItem->display( ).../ViewController.php:102
140.875515870760K2ViewItem->display( ).../view.html.php:742
150.875515870760K2ViewItem->loadTemplate( ).../HtmlView.php:230
160.879316043696include( '/var/www/vhosts/shan.info/httpdocs/templates/gk_publisher/html/com_k2/templates/default/item.php' ).../HtmlView.php:701
back to top