Support » Plugins and Hacks » Nextgen gallery display tags below images
7 years, 9 months ago
I think I’ll kick myself as It’s driving me insane…. is there an easy way to get the tags for an image in Nextgen Gallery, such as picture->tags ?
1. I get my picture array ($pictures = $wpdb->get_results(“SELECT t.*, tt.* FROM $wpdb->nggallery AS t INNER JOIN $wpdb->nggpictures AS tt ON t.gid = tt.galleryid “);)
2. then can pull all my other info (eg.
$imageID = $picture->pid;
$galleryID = $picture->galleryid;
but then I’m stuck… the tags don’t seem to have an easy reference.
I stumbled across this but it doesn’t seem to work.
$picture_tags = $nggTags->get_tags_from_image($imageID);
any help would be appreciated.
7 years, 8 months ago
I need the same thing. You can try this
But I can’t make it work.
7 years ago
I found a way to do this and since I couldn’t find it anywhere else I thought I post it here, even though this question where asked a few month ago:
<?php $tags = wp_get_object_terms($image->pid,'ngg_tag') ?>
<?php foreach ( $tags as $tag ) : ?>
<a href="<?php bloginfo('url'); ?>/tag/<?php echo $tag->slug; ?>"><?php echo $tag->name; ?></a>
<?php endforeach; ?>
(This just prints the tags as links to http://example.com/tag/example-tag, I guess that the links won’t work but you get the point :D)
This would be added in your ngg gallery template, inside the loop for printing out the images.