Show job count in category sidebar
I know that it's possible to show the total number of jobs in the sidebar using a text widget, exec php and this code:
<?php
$count_pages = wp_count_posts('job_listing');
echo $count_pages->publish;
?> Jobs
However, I'd like to be able to show the number of jobs in each of the sub-categories, when a visitor expands the Job Category area in the sidebar.
I'd like it to display something like:
Job Parent (80)
- Sub cat 1 (10)
- Sub cat 2 (15)
- Sub cat 3 (5)
- Sub cat 4 (50)
Can someone please help me out here?
Thanks,
Matt