Display multiple categories on post!
Does anyone know how to display all the categories/subcategories... that belongs to a particular post in a post?
First, I tried this:
Code:
<?php
foreach((get_the_category()) as $category) {
echo $category->cat_name . '
';
echo '[*]' . $category->cat_name . '';
}
?>
The problem is that it doesn't order by:
PARENT CATEGORY
- Sub Category
-- Sub Sub Category
It simply displays all the categories together, so you can't tell what is a parent or a child category. I've tried looking up on the internet, but nobody has an example of this.
If someone knows how to show them on a post and on one of the
index.php "columns", it would be a big help...
Cheers,
Gabriel