Wordpress - Displaying the category name of a custom post type
So this is what I needed:
<?php
$terms = get_the_terms( $post->ID , 'board' );
foreach ( $terms as $term ) {
echo $term->name;
}
?>
use terms like this :
$terms = get_the_terms($post->ID, 'Enter_your_taxonomy_here' );
if ($terms && ! is_wp_error($terms)) :
$tslugs_arr = array();
foreach ($terms as $term) {
$tslugs_arr[] = $term->slug;
}
$terms_slug_str = join( " ", $tslugs_arr);
endif;
echo $terms_slug_str;
In case if someone looking for this in 2019. With this you are getting CUSTOM POST TYPE name with URL
<?php
$terms = wp_get_post_terms( $post->ID, 'PLACE-HERE-YOUR-TAXONOMY');
foreach ( $terms as $term ) {
$term_link = get_term_link( $term );
echo '<a href="' . $term_link . '">' . $term->name . '</a>' . ' ';
}
?>