I tried to figure out how to separate the custom post type taxonomies.
$terms = get_the_terms( $post->ID , array( 'commitments', 'type' ) );
foreach ( $terms as $term ) {
$term_link = get_term_link( $term, array( 'commitments', 'type' ) );
if( is_wp_error( $term_link ) )
continue;
echo '<a href="' . $term_link . '">' . $term->name . '</a>';
}
Each taxonomies show correctly. However, I cannot separate them in comma. it shows "TaxonomyATaxonomyB" but I want to show it as "TaxonomyA, TaxonomyB"
How to do it? or is there any other way around?
Thanks!
echo ', <a href="' . $term_link . '">' . $term->name . '</a>';