Display tags of custom taxonomy
-
I created a custom taxonomy. This works well and I wanted to display the chosen tags in post-meta just like “tags” and “category”.
With the following code I managed this:
<?php $terms = get_terms('mytax'); echo '<b>Special tags </b>'; foreach ($terms as $term) { //Always check if it's an error before continuing. get_term_link() can be finicky sometimes $term_link = get_term_link( $term, 'mytax' ); if( is_wp_error( $term_link ) ) continue; //We successfully got a link. Print it out. echo '<a href="' . $term_link . '">' . $term->name . '</a> '; } ?>
Source: here
But I found out that if I clicked on a custom taxonomy
https://www.mysite.de/blog/mytax/xyz
you already support the list of custom taxonomies in the post overview site in the loop.How can I use this function myself??
Reason: Your function is a bit nicer because you output the name of the custom taxonomy and set “and” between the last and 2nd last tag… ??Thanks for some advice,
Enno
Viewing 4 replies - 1 through 4 (of 4 total)
Viewing 4 replies - 1 through 4 (of 4 total)
- The topic ‘Display tags of custom taxonomy’ is closed to new replies.