Display child but hide parent in sidebar?
-
Hi all
First of all, thanks in advance for any help. I’ve searched the forums but haven’t been able to find this specifically.
I’ve been trying to do something that seems fairly simple yet can’t get it to work:I need to display the a list of the child of a category in the sidebar while hiding its parent, and another list of only the parents.
The main issue is that the each post I have in the blog is inside both the child AND the parent category… Overall I have 10 parent categories, 10 child categories and 10 posts. I’m using the ‘my custom widgets’ to then incorporate them as separate widgets into the sidebar, which is working.
The reason why I’m doing this is to be able to show the content through 2 different menus (clients and project type) in the sidebar and keep them both highlighted while in the current post.
I’ve tried using all of these (separately)
OPTION 1)
wp_list_categories(‘orderby=ID&title_li=&depth=1’); –to show parents
wp_list_categories(‘orderby=ID&title_li=&depth=2’); –to show children only, BUT it shows parents as well.OPTION 2)
wp_list_categories(‘orderby=ID&title_li=&depth=1’); –to show parents
wp_list_categories(‘orderby=ID&title_li=&child_of=3,4,5,6,ETC’); — to show children, BUT displays “no categories”OPTION 3)
wp_list_categories(‘orderby=ID&title_li=&depth=1’); –to show parents
if (in_category(‘3,4,5,6’)) { wp_list_categories(‘orderby=id&title_li=&child_of=3,4,5,6’); } –to show childrent, But displays “no categories”Excuse me if this sounds overly confusing… I can clarify further if needed.
Thanks
C
- The topic ‘Display child but hide parent in sidebar?’ is closed to new replies.