Skip to content

Instantly share code, notes, and snippets.

@srikat
Last active Aug 3, 2017
Embed
What would you like to do?
Comma separated unlinked taxonomy terms in WordPress. https://sridharkatakam.com/comma-separated-taxonomy-terms-in-wordpress/
// Displays comma separated Staff Position taxonomy terms.
function sk_entry_terms() {
$terms = get_the_terms( get_the_ID() , 'staff-position' );
if ( ! empty( $terms ) ) {
echo '<p class="entry-meta"><span class="entry-terms">';
foreach ( $terms as $term ) {
$entry_terms .= $term->name . ', ';
}
$entry_terms = rtrim( $entry_terms, ', ' );
echo $entry_terms . '</span></p>';
}
}
<?php echo sk_entry_terms(); ?>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment