How to put commas between each output term when using get_term_link?
-
I am trying to use get_term_link to have a space and comma between each of the ‘.$term->name.’ that is output. In the example below I can easily add a space and comma after the closing /a anchor but that will also add a comma on the final term… is there a way to NOT include a comma after the last output term?
<?php foreach($all_tearm as $term){ if($term->taxonomy == 'restaurant_choices'){ echo '<a href="' .get_term_link($term->slug, 'restaurant_choices') .'">'.$term->name.'</a>, '; } } ?>
So the above will output:
a,b,c,d,But I need:
a,b,c,d
Viewing 2 replies - 1 through 2 (of 2 total)
Viewing 2 replies - 1 through 2 (of 2 total)
- The topic ‘How to put commas between each output term when using get_term_link?’ is closed to new replies.