You are currently using get_the_category_list
, this will list all the terms of the 'category' taxonomy. Other taxonomies that come bundled with WordPress by default include tags, they're not post meta as some people would believe, nor are they dedicated tables.
As such they work with all the other taxonomy term APIs. So Instead use get_term_list
, passing in the name of your review category taxonomy as the second parameter.
Also I would not do if ( $category_list )
, instead it would be less ambiguous to do: if ( !empty( $category_list ) )
e.g. if using with standard categories:
global $post;
$terms = get_the_term_list( $post->ID, 'category', '<span class="the-category">', ', ', '</span>' );
if( !empty($terms) ){
echo $terms;
} else {
// none found?
}
For finer grained control, you can get the term objects themselves rather than a string using wp_get_object_terms
e.g.
$terms = wp_get_object_terms($post->ID, 'category');
if(!empty($terms)){
if(!is_wp_error( $terms )){
foreach($terms as $term){
echo '<span class="the-category"><a href="'.get_term_link($term->slug, 'category').'">'.$term->name.'</a></span>';
}
}
} else {
// no terms found
}
This would allow you to do things such as access term meta using the term ID, which, if you have setup correctly, could be used to store colours and image IDs.
When possible, always use the term oriented functions, rather than the category and tag specific functions. WordPress will end up using them internally anyway to do the same thing, and it makes dealing with custom taxonomies so much easier as you need only learn a single API rather than 2.