List of Categories of Custom Post type in template, if you want to Get all categories of custom post type in you php template you can find code sample below.
in while loop
1 2 3 4 5 6 7 8 9 10 11 | <?php $terms = get_the_terms($post->ID, 'TYPE-YOUR-TAXONOMY' ); 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; ?> |
Category with link
1 2 3 4 5 6 7 | <?php $terms = wp_get_post_terms( $post->ID, 'TYPE-YOUR-TAXONOMY'); foreach ( $terms as $term ) { $term_link = get_term_link( $term ); echo '<a href="' . $term_link . '">' . $term->name . '</a>' . ' '; } ?> |