The following code should produce the results you are looking for:
$post_tags = get_the_tags();
if ( $post_tags ) {
foreach( $post_tags as $t ) {
$url = get_term_link( $t->name, $t->taxonomy );
$img = $taxonomy_images_plugin->get_image_html( 'detail', $t->term_taxonomy_id );
if( !empty( $img ) )
print '<a title="' . $t->name . '" href="' . $url . '">' . $img . '</a>';
}
}
Best wishes,
-Mike
Thanks mfields
It worked, I would like to know how to display images of custom_taxonomies, I created two, actor and website, where I have to edit the images appear to show the images of these custom_taxonomies?
Thank you for your help.
This code will display a list of all terms of a given taxonomy that have images associated to them via the plugin. Please change the second argument of get_the_terms() to the value of the slug of your custom taxonomy.
$terms = get_the_terms( $post->ID, 'my-custom-taxonomy-slug' );
if ( $terms ) {
foreach( $terms as $t ) {
$url = get_term_link( $t->name, $t->taxonomy );
$img = $taxonomy_images_plugin->get_image_html( 'detail', $t->term_taxonomy_id );
if( !empty( $img ) )
print '<a title="' . $t->name . '" href="' . $url . '">' . $img . '</a>';
}
}
Thank mfields gave correctly, perfect.
Longer had a code that tried to edit most failed, it can also help would be very grateful.
<?php
$backup = $post;
$tags = wp_get_post_tags($post->ID);
if ($tags) {
$tag_ids = array();
foreach($tags as $individual_tag) $tag_ids[] = $individual_tag->term_id;
$args=array(
‘tag__in’ => $tag_ids,
‘post__not_in’ => array($post->ID),
‘showposts’=>9, // Number of related posts that will be shown.
‘caller_get_posts’=>1
);
$my_query = new wp_query($args);
if( $my_query->have_posts() ) {
echo ‘<h3>Outros Vídeos</h3>
‘;
}
}
$post = $backup;
wp_reset_query();
?>
It shows post related statement based on tags, I think custom taxonomy would be best for my use.
Again thank you for your help.