Thanks for fixing this so quickly Umeesh. Will add the review soon.
The code used is here for anyone that will find it useful.
<?php // this can go in functions.php or in the top of the template file
/**
* Fetch all the terms for the user and return a required HTML for the template
*
* @param $user_id
* @param $taxonomy
*
* @return string
*/
function get_user_tag_list( $user_id, $taxonomy ) {
//Get all the tags assigned to user for the queried taxonomy
$user_tags = wp_get_object_terms( $user_id, $taxonomy->name );
$user_tag_content = '';
if ( ! is_wp_error( $user_tags ) && ! empty( $user_tags ) ) {
//Store the url of each term in array
$tag_list = array();
foreach ( $user_tags as $tag ) {
$term_url = site_url() . '/' . $taxonomy->rewrite['slug'] . '/' . $tag->slug;
$tag_list[] = sprintf( '<a href="%s">%s</a>', $term_url, ucfirst( $tag->name ) );
}
//If we have tag list for the user
if ( ! empty( $tag_list ) ) {
$user_tag_content = '<div class="member-tags-list">' . implode( ' / ', $tag_list ) . '</div>';
}
}
return $user_tag_content;
}
?>
Thats the function, now call it in the templates
<?php
// echo the tags in a list of users
$taxonomy = get_taxonomy('work_types');
$user_tag_content = get_user_tag_list( $author_id, $taxonomy );
echo $user_tag_content;
?>
This is a different setup for the archive if you are using the code from the plugin: template user-tags/templates/user-taxonomy-template.php
<?php
// put the tags in the taxonomy archive loop (adapted from the plugin template)
$user_tag_content = get_user_tag_list( $user_id, $taxonomy );
$c = '
<div class="artist-member">
<h4><a href="' . esc_url( get_author_posts_url( $user_id ) ) . '">' . get_the_author_meta( 'display_name', $user_id ) . '</a></h4>
<div id="profile-pic" style="float:left; width:100px; height:100px; margin:0 10px 10px 0;">
<a href="' . get_author_posts_url( $user_id ) . '" title="">
<img src="' . $thumb . '" alt="" width="' . $width . '" height="' . $height . '" title="" />
</a>
</div>' . $user_tag_content . '
<p>' . $trap . '</p>
<hr style="border: 0; height: 0; border-top: 1px solid rgba(0, 0, 0, 0.1); border-bottom: 1px solid rgba(255, 255, 255, 0.3);"></hr>
</div>';
$template_content .= apply_filters( 'ut_tepmplate_content', $c, $user_id );
}
echo $template_content;
?>