Loop through comma-separated string in gallery custom field
-
Hi,
I’m trying to adapt the setup that you can find here so that instead of pulling in the gallery images thumbnails it will show an album.
I got it pulling in the album correctly but to get Isotope working I need to insert some tags as classes for the wrapping divs, so Isotope knows what to sort. I have added these tags in a custom field for each gallery.
For the original setup this code was working fine for extracting the tags from the images built-in tags field:
<?php $tags = wp_get_object_terms($image->pid,'ngg_tag'); $tag_string = ''; ?> <?php foreach ( $tags as $tag ) : ?> <?php $tag_string = $tag_string.$tag->slug.' '; <?php endforeach; ?>
But simply switching out
$tags = wp_get_object_terms($image->pid,'ngg_tag');
for
$tags = nggcf_get_gallery_field($gallery->ID, "Tags");
is throwing “Invalid argument supplied for foreach()…” errors.
Does anyone know how I can access and extract the values in that custom field?
Thanks in advance for any help on this!
https://www.ads-software.com/extend/plugins/nextgen-gallery-custom-fields/
- The topic ‘Loop through comma-separated string in gallery custom field’ is closed to new replies.