Because include=3
means “show only posts in category 3″. Posts in categories 5 & 6 won’t be shown – even if categories 5 & 6 are children of category 3 – unless those posts are also explicitly filed under category 3.
is there absolutely any way where i can specify only a particular parent class and then automatically have its children also listed? But I only want 1 parent at a time to be listed.
Another possible workaround that i have created requires me to add html tags like ul/li to the php code like
<li id='heybaby'>".wp_list_categories('include=3&hide_empty=0&hierarchical=1&title_li=')."</li>"
but over here i cannot access the #heybaby via css because of wp_list_categories. If i change the wp_list_categories to something else (along with respective include statements etc…) the css code will work? Why is it that for wp_list_categories the css doesn’t work? Any ideas?
i cannot access the #heybaby via css because of wp_list_categories
I don’t see any reason why you can’t.
Maybe because wp_list_categories is returning list elements inside the one it’s been placed in, resulting in invalid markup.
<li id='heybaby'>
<li>Result 1</li>
<li>Result 2</li>
<li>Result 3</li>
</li>
Chad
(@lynneandchad)
can you give the
UL an id of ‘heybaby’ instead? Then grab it with
ul#heybaby li
Maybe because wp_list_categories is returning list elements inside the one it’s been placed in, resulting in invalid markup.
So use:
<li id='heybaby'><ul>
<?php wp_list_categories('include=3&hide_empty=0&hierarchical=1&title_li=');?></ul></li>
There’s nothing in the basic approach (using the valid or invalid markup) that would prevent you from using #heybaby in CSS to target the category list items. I do it all the time.