Reputation: 979
I could display the selected category name in the following way:
<?php if (have_posts()) :
single_cat_title();
while (have_posts()) : the_post();?>
...
The problem is that I cannot display parent category name of selected category as well. Could you please help me.
Upvotes: 1
Views: 283
Reputation: 4050
You could use the get_category_parents()
helper function.
<?php if (have_posts()) :
single_cat_title();
while (have_posts()) : the_post();
echo get_category_parents($cat, TRUE, ' » ');
?>
You would want to do this in the loop, rather than above it.
Upvotes: 1