Can't get a total count for posts in listed loop of category
-
I can’t get the total post count for the number of posts in a category that is selected. I understand that is a bit confusing. If I click on a category or taxonomy in my menubar I get a list of posts belonging to that category or taxonomy. All are headed with the name of the category or taxonomy. I have it showing a set number with the navigation pref/next links.
What I’m trying to get working is adding the count of posts belonging to that category or taxonomy next to the heading. Preferably I would like it to show something like showing 50 of 150 etc.
Anyway, all my attempts either breaks the site, lists all categories with their total counts or nothing shows up at all.
Its seems
wp_count_posts()
is what I need, except I can’t get it to work. Bellow is what I’m currently using for the heading in my categories template:<H3>Showing all items for:</H3> <H2><?php single_cat_title() ?>
The follow is one of my attempts that I think is on the right track but returns no result:
<H3>Showing all items for:</H3> <H2><?php single_cat_title() ?> - <?php $count_posts = wp_count_posts(); ?>
Also if someone has the answer, can you also get this to work on a taxonomy category?
Thanks and Cheers,.
- The topic ‘Can't get a total count for posts in listed loop of category’ is closed to new replies.