WordPress.org

Ready to get started?Download WordPress

Forums

NextGEN Gallery
Image name in gallery (2 posts)

  1. mcdoopy
    Member
    Posted 3 years ago #

    I'd like the name of each image to appear under each image in the gallery. Is there an easy way to set this? I don't mind editing code/.php files if I have to.

    Thanks!

  2. davesnothere
    Member
    Posted 3 years ago #

    You need to add <? echo $image->filename ?> to the gallery.php file. probably about line 40 or so. I've modified mine a bit, but here's how my code looks, to give you an idea on where it goes:

    <?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" >
    			<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><? echo $image->filename ?>
    		</div>
    	</div>
    
    	<?php if ( $image->hidden ) continue;
    	if ( $gallery->columns > 0 && ++$i % $gallery->columns == 0 ) {
    		print '<br style="clear: both" />';
    	}
    	endforeach; ?>

    Also, you can try <?php var_dump($gallery) ?><?php var_dump($images) ?> to see everything you can access.

Topic Closed

This topic has been closed to new replies.

About this Plugin

About this Topic

Tags

No tags yet.