Im trying to echo a set of values for categories. What I'd like to do is if there are more than one value, append a comma afterwards. Here's a snippet of what I have:
<?php foreach((get_the_category()) as $category) { echo $category->cat_name . ', '; } ?>
The problem with this is that categories with one value will have a comma at the end.
See Question&Answers more detail:os