Custom Post type Taxonomy Terms with Link
If you want to display your custom post type taxonomy term with the link in a post, you can use this below code. Note: please replace ‘typetaxonomyname’ with your taxonomy slug.
<?php
// Get terms for post
$terms = get_the_terms( $post->ID , 'scope_of_work' ); // Loop over each item since it's an array
if ( $terms != null ){ foreach( $terms as $term ) { // Print the name method from $term which is an OBJECT
echo'' ;
print '<a href="'.get_term_link($term).'">'.$term->name.'</a>';// Get rid of the other data stored in the object, since it's not needed
echo'<span style="color:#b83116;"> • </span>' ;
unset($term); } } ?>
Custom Post type Taxonomy Terms without Link
If you want to display your custom post type taxonomy term without the link in a post, you can use this below code.
<?php
// Get terms for post
$terms = get_the_terms( $post->ID , 'typetaxonomyname' ); // Loop over each item since it's an array
if ( $terms != null ){ foreach( $terms as $term ) { // Print the name method from $term which is an OBJECT
echo'' ;
print $term->name; // Get rid of the other data stored in the object, since it's not needed
echo'<span style="color:#b83116;"> • </span>' ;
unset($term); } } ?>
