Nextgen Gallery – adding class to thumnail based on Tags?
-
I want to be able to add class names to the thumbnails by using the comma separated tags list. I am implementing some javascript sorting using ISOTOPE which needs me to be able to identify each image using a series of classes.
I have already created a template file called gallery-isotope so that i can make these changes and not lose them.
For example if I had added the tags {TAG1, TAG2, TAG3} to an image, I would want to pull them out and add them into the code as shown below.
<!-- 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 TAG1 TAG2 TAG3" > <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>
I don’t know how to look up the list of tags for each image, and how to then echo them out into the correct spot.
I would really appeciate the help, if you can tell me how to do this.
I think that it would be a useful feature to add a ‘custom class’ section (kinda like the tags thing) so you could add comma separated classes as default functionality for this plugin.
- The topic ‘Nextgen Gallery – adding class to thumnail based on Tags?’ is closed to new replies.