Is there a way to display the parent categories and subcategories for a particular post (ie. for use on single.php
).
I've tried using get_the_category_list()
, but it displays a list like this:
- Subcat1
- ParentCat1
- Subcat2
- Subcat3
- ParentCat2
Even if you try the 'single' or 'multiple' display argument, it doesn't give me what I want, which is this:
- ParentCat1
- Subcat1
- Subcat2
- ParentCat2
- Subcat 3
Is it possible to get the categories to be displayed like this? Even using another method (like get_terms()
)?