/ Published in: PHP
Create a comma separated list of a post's custom taxonomy terms.
Expand |
Embed | Plain Text
Copy this code and paste it in your HTML
<?php // Get a list of terms for this post's custom taxonomy. $project_cats = get_the_terms($post->ID, 'TAXONOMY_NAME'); // Renumber array. // Each array item is an object. Display its 'name' value. echo $project_cats[$cat_count]->name; // If there is more than one term, comma separate them. echo ', '; } } ?>