Support » Fixing WordPress » How to get a list of subcategories from one category

  • Hi,

    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

  • 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!



  • The topic ‘How to get a list of subcategories from one category’ is closed to new replies.