Support

Account

Home Forums Add-ons Gallery Field Gallery field – echo a custom taxonomy as a class in the image container Reply To: Gallery field – echo a custom taxonomy as a class in the image container

  • Thanks! This did work. I had tried something similar but was using “$image->ID”
    It took me bit to figure out where to put it. In case anyone else is wondering, you need to put it INSIDE the foreach statement!

    <?php 
      $images = get_field('images');	
      if( $images ): ?>		
        <?php foreach( $images as $image ): 
            $terms = wp_get_object_terms($image['ID'], 'image_category');
        ?>

    Another WP genius was helping me and had suggested using wp_get_post_terms, which also works.

    Thanks so much for your help!