@shutez,
If you know the ID of the term you want—using something like wp_get_object_terms()—you can just use the following code (based on the above snippet from @stevejonesdev) where $tax_term_id
is the ID of the term image you want.
$images = get_option('taxonomy_image_plugin');
echo wp_get_attachment_image( $images[$tax_term_id], 'medium' );
For others who stumble across this thread, I also thought I’d add this snippet which checks to make sure that the term has an image at all. Otherwise, WordPress throws an error (at least with wp_debug set to TRUE).
$terms = wp_get_object_terms( $post->ID, 'TAXONOMY NAME', array('fields' => 'all') ); // get all the terms on that post
$images = get_option('taxonomy_image_plugin'); // get the taxonomy images array
foreach($terms as $term) { // iterate through each term
$term_id = $term->term_taxonomy_id; // get the ID of the term
if( array_key_exists( $term_id, $images ) ) { // check if term has an image
echo wp_get_attachment_image( $images[$term_id] ); // if it does, echo that image
}
}
Note to @stevejonesdev: I moved $images
outside of the foreach loop. It seems to work the same and I imagine this means a few less queries run on the database.