I have a post which is related to 3 categories, top level category, city and street.
I want to display the categories in the following order: City > Street (excluding top category)
The following code displays the categories in alphabetical order:
foreach((get_the_category()) as $category) {
echo $category->cat_name . ' >';
}
The function get_the_category has no means of displaying it parent / child order.
So how can I display the categories in parent / child order like wp list categories ?
PS. No, I can't use wp_list_categories() because it has no relation the the post and lists all parent / child categories.
Any help appreciated.