How to get a list of subcategories from one category (1 post)

  1. Joshaw
    Posted 2 years ago #


    At the moment I have some jQuery which I have used to create a category filter on some of my category pages.

    The pages are categorised according to country (using a category-$country-slug.php template).
    I want to filter the posts shown on these pages by subcategories from the parent category 'resort-types'.

    To add the categories as classes onto each post I have used:
    <li class="<?php the_category_unlinked(' '); ?>">
    <!--post here-->

    which gives me all the 'resort-type' categories I want but also givse me the 'country' category.

    How can I get a list of the subcategories to put in the class of each post? All I can find is how to get an

  2. list but I just want a simple text list with spaces (e.g. class="family-friendly advanced budget")

    Any suggestions/advice would be greatly appreciated!



Topic Closed

This topic has been closed to new replies.

About this Topic


No tags yet.