List Current Post Taxonomies and Terms

To be used in a WordPress template. List full taxonomy, or only custom post type associated with the post. Examples include a linking or non linking list.

//To list FULL custom taxonomy 
<?php
$taxonomy = 'replace_this_with_taxonomy_name';
$queried_term = get_query_var($taxonomy);
$terms = get_terms($taxonomy, 'slug='.$queried_term);
if ($terms) {
  echo '<ul>';
  foreach($terms as $term) {
  	echo '<li><a href="'.get_term_link($term->slug, $taxonomy).'">'.$term->name.'</a></li>';
  }
  echo '</ul>';
}
?>
 
//To list ONLY custom taxonomy associated with post:
 
//non-linking, list only:
 
<?php $terms = wp_get_post_terms($post->ID,'replace_this_with_taxonomy_name');
 $count = count($terms);
 if ( $count > 0 ){
     echo "<ul>";
     foreach ( $terms as $term ) {
       echo '<li><a href="'.get_term_link($term->slug, 'replace_this_with_taxonomy_name').'">'. $term->name . "</a></li>";
		 }
		 echo "</ul>";
	 }?>
 
//links to taxonomy archive:
 
<?php $terms = wp_get_post_terms($post->ID,'replace_this_with_taxonomy_name');
 $count = count($terms);
 if ( $count > 0 ){
     echo "<ul>";
     foreach ( $terms as $term ) {
       echo '<li><a href="'.get_term_link($term->slug, 'replace_this_with_taxonomy_name').'">'. $term->name . "</a></li>";
		 }
		 echo "</ul>";
	 }?>