[Plugin: Taxonomy Images] Help displaying taxonomy images within the loop
-
Hi,
First thanks for the great plugin, I’m trying to display images for custom taxonomies for each post, but I’m struggling. I have the following code:<?php $tax = 'colours'; ?> <?php if ( have_posts() ) while ( have_posts() ) : the_post(); ?> <div class="panel"> <a href="<?php the_permalink(); ?>" title="<?php the_title(); ?>"><?php the_post_thumbnail(array(212, 212)); ?></a> <h2><a href="<?php the_permalink(); ?>" title="<?php the_title(); ?>"><?php the_title(); ?></a></h2> <div class="swatches"> <ul> <?php $terms = apply_filters( 'taxonomy-images-get-terms', '', array('taxonomy'=> $tax )); foreach( (array) $terms as $term ) { echo '<li>' . wp_get_attachment_image( $term->image_id, 'thumb' ) . '</li>' ; } ?> </ul> </div> </div> <?php endwhile; wp_reset_query(); ?>
It does display the images for the custom taxonomies, unfortunately it displays them in every post, not just the posts that have bee allocated the taxonomy. What do I need to change to ensure that the taxonomy images are displayed for the post that has been allocated to rather than for all of the posts.
Thanks
Garyhttps://www.ads-software.com/extend/plugins/taxonomy-images/
Viewing 3 replies - 1 through 3 (of 3 total)
Viewing 3 replies - 1 through 3 (of 3 total)
- The topic ‘[Plugin: Taxonomy Images] Help displaying taxonomy images within the loop’ is closed to new replies.