Revision: 55668
Updated Code
at February 16, 2012 10:44 by f6design
Updated Code
<?php
// Get a list of terms for this post's custom taxonomy.
$project_cats = get_the_terms($post->ID, 'TAXONOMY_NAME');
// Renumber array.
$project_cats = array_values($project_cats);
for($cat_count=0; $cat_count<count($project_cats); $cat_count++) {
// 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.
if ($cat_count<count($project_cats)-1){
echo ', ';
}
}
?>
Revision: 55667
Initial Code
Initial URL
Initial Description
Initial Title
Initial Tags
Initial Language
at February 16, 2012 10:30 by f6design
Initial Code
<?php
// Get a list of terms for this post's custom taxonomy.
$project_cats = get_the_terms($post->ID, 'my_taxonomy_name');
// Renumber array.
$project_cats = array_values($project_cats);
for($cat_count=0; $cat_count<count($project_cats); $cat_count++) {
// 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.
if ($cat_count<count($project_cats)-1){
echo ', ';
}
}
?>
Initial URL
Initial Description
Create a comma separated list of a post's custom taxonomy terms.
Initial Title
Wordpress: Comma separated list of taxonomy terms
Initial Tags
wordpress
Initial Language
PHP