I'm using the following in my query to display the child categories
<?php
foreach((get_the_category()) as $childcat) {
if (cat_is_ancestor_of(1, $childcat)) {
echo $sep,'<a href="'.get_category_link($childcat->cat_ID).'">',$childcat->cat_name,'</a>';
$sep = ' / ';
}}
?>
So this is then displaying as follows:
Category a / Category b / Category c
The problem is when there's more than one post on the page the next lot show as
/ Category a / Category b / Category c
i.e. it's just continuing to add the forward slash and not simply starting the query again.
Basically I need it so the separator does not show at the beginning or end of the category list.
Any help would be greatly appreciated.