I'd like to have a line under the title that displays the usual "Filed Under", but want to only display parent categories.
I normally use <?php the_category(', ') ?> but this obviously pulls the child categories too.
Is it possible to display on parent categories, and if so, how?
i would like to know this too?
is there a way to display the parent category without the child category?
deanhatescoffee
Member
Posted 5 years ago #
<?php the_category('depth=1') ?>
That will show only the first level (depth=1) of categories.
i tried
<?php the_category('depth=1') ?>
but there is no change it still displays the child category instead of the parent category.
deanhatescoffee
Member
Posted 5 years ago #
Aw snap, I'm sorry, I was thinking of wp_list_pages. My apologies.
@ nico & bmg - This should do it:
<?php echo "Category: ";the_category(','); ?>
deanhatescoffee
Member
Posted 5 years ago #
Bah, maybe not. Darn. I'm using this code on a friend's blog and it's only displaying the sub-category, not the main category. I do remember that at one time both the main and sub-categories were displayed, but now I can't seem to figure out how we figured that out.
deanhatescoffee
Member
Posted 5 years ago #
Oh wow, I completely confused myself into misunderstanding the purpose of this question. You want to show the parents, but not the child categories - I thought it was the other way around. Sheesh. Sorry 'bout that. I'm out of ideas. :)
I am searching the forums for the same question! Does anyone have an idea?