/ Published in: PHP
Create a comma separated list of a post's custom taxonomy terms.
Expand |
Embed | Plain Text
<?php // Get a list of terms for this post's custom taxonomy. $project_cats = get_the_terms($post->ID, 'TAXONOMY_NAME'); // Renumber array. for($cat_count=0; $cat_count<count($project_cats); $cat_count++) { // Each array item is an object. Display its 'name' value. // If there is more than one term, comma separate them. if ($cat_count<count($project_cats)-1){ echo ', '; } } ?>
You need to login to post a comment.
