In the blog I'm developing I've engineered some tabs which equate to the 'top level' categories found in the blog heirarchy. These appear throughout the site and are intended to offer more obvious navigation. When in a first level category, the sidebar category list is listing all the children categories of the current one which have entries and that's working fine.
However, on the home page, I'm wanting the sidebar to list just the top level categories, together with the post count for each. That's not a problem and I make a different call to do that. This one in fact:
My problem is that what I would like it to do is to list each top level category and count essentially as a roll-up of itself and it child categories. In this way, I'd hope that a top level category would appear in the list even if it had no posts, so long as at least one of its child categories had a post. Additionally, I'd like the post count to be a roll up of the posts in all its child categories.
I know there's the option to display the child categories and to display all categories but, just to be difficult, I only want to display a category if there is at least one post somewhere down its category tree.
While I made a nice mess of explaining it, it strikes me as being somthing that's probably quite a common, or at least sensible, thing to want to do. As a result, I've looked through the codex and the forums to find info on some function or parameters to do it, but there doesn't seem to be.
I'm happy enough writing some php to do it myself, but if it can be done using the stock WP functionality then I'd much rather do that.
Does anyone know if this can be done?