• Bauholz

    (@bauholz)


    Hello,

    I’m trying to build a list of related category links for each post, using nested unordered lists, grouped by parent categories e.g:

    • Parent Category
    • Child category
    • Another child category
    • A second parent category
    • A child of the second parent
    • etc

    … with each of the Parent Category / Child category items being a link to that category.

    Does anyone have any ideas? I can’t find a variety of the_category that works.Many thanks in advance.

Viewing 1 replies (of 1 total)
  • Frumph

    (@frumph)

    That all depends on if you can get the parent categories then yeah you can get the child categories for that parent real easily.

    If you’ve got the parent category object

    $child_cats = get_term_children($parent_cat->term_id, 'category');
Viewing 1 replies (of 1 total)
  • The topic ‘List a post's child categories, grouped by Parent’ is closed to new replies.