cat_name comma seperated
-
I’m currently trying to display categories from each post and was hoping to seperate each category link by a comma, except or the last category.
<?php foreach((get_the_category()) as $category) { if($category->name=='Uncategorized') continue; $category_id = get_cat_ID( $category->cat_name ); $category_link = get_category_link( $category_id ); echo '<a href="'.$category_link.'">'; echo $category->cat_name; echo '</a>'; } ?>
Any ideas?
Viewing 2 replies - 1 through 2 (of 2 total)
Viewing 2 replies - 1 through 2 (of 2 total)
- The topic ‘cat_name comma seperated’ is closed to new replies.