Display terms associated image of a single-post
-
I am on single-post.php and I want to display my post’s taxonomy terms & the term’s associated images. Ideally, I’d like the taxonomy description there too. No idea why this has me stumped because it seems like it should be a simple thing to do.
I have this code, which displays just the post’s term’s images:
$terms = apply_filters( 'taxonomy-images-list-the-terms', '', array( 'taxonomy' => 'comedians', ) ); foreach( (array) $terms as $term){ echo $term; }
And then I have this code, which displays all of the term’s images, with the terms & links & descriptions:
$terms = apply_filters( 'taxonomy-images-get-terms', '', array( 'taxonomy' => 'comedians', ) ); if ( ! empty( $terms ) ) { print "\n" . '<div class="row">'; foreach( (array) $terms as $term ) { print "\n" . '<div class="four columns">'; print "\n\t" . '<a href="' . wp_get_attachment_url( $term->image_id ) . '" rel="lightbox unique-woo-feature">' . wp_get_attachment_image( $term->image_id, 'unique-woo-feature' ) . '</a>'; print "\n\t" . '<h5>' . esc_html( $term->name ) . '</h5>'; print "\n\t" . '<p>' . esc_html( $term->description ) . '</p>'; print "\n" . '</div>'; } print "\n" . '</div>'; }
What I need is something in between. I understand the crucial part is the filter, specifically the difference between
get-terms
andlist-the-terms
but the latter one, which gets the post’s terms like I need, doesn’t seem to do anything but just the images no matter what I do.Any help with this, much appreciated.
- The topic ‘Display terms associated image of a single-post’ is closed to new replies.