How to remove comma from end of category list
-
Hi there, I’m using the following code to recall a list of categories whilst removing the link.
<?php foreach((get_the_category()) as $category) { echo $category->cat_name . ', '; } ?>
But unfortunately it is adding a comma to the last cat as well.
I’ve had a look around and can’t find a working fix, can anyone help?
Thanks!
Viewing 2 replies - 1 through 2 (of 2 total)
Viewing 2 replies - 1 through 2 (of 2 total)
- The topic ‘How to remove comma from end of category list’ is closed to new replies.