Show Categories on Post

  • Hi,

    I'm trying to pull the category(ies) that the current post is in. The issue I have is that I want the categories to be displayed 'Published in 'Cat 1', 'Cat 2'' where if there is multiple categories it is displayed next to the current with a comma separating. If it has a single category, it doesn't print a comma. Currently, it prints:

    Published in 'Cat 1'

    Published in 'Cat 2'

    My code is below with the template

    <?php perch_blog_post_categories(perch_get('s')); ?>


    <p>Published in <a href="archive.php?cat=<perch:category id="catSlug" />"><perch:category id="catTitle" /></a></p>

    Hope this makes sense.