Have you looked at the ‘hide_empty’ parameter for the template tag, wp_list_categories?
Additional resources:
Template_Hierarchy
Stepping into Templates
[edit]
Also some plugins in this thread:
http://wordpress.org/support/topic/114534?replies=3
Thread Starter
shovi
(@shovi)
cool, that the hide_empty parameter worked (sort of)…one more thing (only because I’m on a deadline and it’s a little cumbersome searching this support forum…)
if I use
<?php wp_list_categories('orderby=name&hide_empty=0&child_of=8'); ?>
how can I replace “8” with a dynamic category variable, so that whatever category I’m viewing I can only see those child categories (and that would mean when I’m at the deepest level this menu won’t show at all right?)?
I’d also need to format the whole thing, but I found some relatively straightforward documentation on the wp_list_categories page.
thanks!
Thread Starter
shovi
(@shovi)
okay, new approach…I am creating category-#.php pages in my theme files and want to drop the child categories using wp_list_categories at the top of each category-#.php page. this will give me a title page for all my topics, but leave the rest of the blog alone.
two issues combined into one…wordpress doesn’t recognize the category-#.php (# is obviously replaced) file. I’m using permalinks instead of index.php?cat=#, is there a setting I’m screwing up? and once that’s fixed, can I use that code above (and hard-code the category # in the child_of attribute) and get this to work?
hardly a dynamic approach to this, but hey, whatever works. thanks to the community for your help!
Try
<?php wp_list_categories(“orderby=name&hide_empty=0&child_of=$parentcat”); ?>
Thread Starter
shovi
(@shovi)
didn’t work, but I fixed it thanks! and for anyone else interested here’s what I did:
* created a category.php Template for all of my child categories, which didn’t have the PHP code above.
* created a category-#.php Template for each of the main categories, and instead of $parentcat above I put the category #.
* styled the category-#.php Template to look nice, using info from the wp_list_categories documentation page.
Hi Showi, could you please post what is the example of website that already used your tricks?
I want to see it 🙂
Thanks and best regards
John Chan