PHP – Separate returned values with space?
-
I am using this code to output the child category slugs that fall within a particular parent category.
<?php foreach((get_the_category()) as $childcat) { if (cat_is_ancestor_of(5, $childcat)) { echo $childcat->slug; }} ?>The problem is that when there is more than one category, they are all inserted as one word – I need to separate them with a space. My guess is that I need to use implode for this (?), but I’m not quite sure how to implement it.
Any ideas?
Viewing 1 replies (of 1 total)
Viewing 1 replies (of 1 total)
The topic ‘PHP – Separate returned values with space?’ is closed to new replies.