Code to count number of posts in multiple collections

Hi, I’m looking for code that will count the number of posts in my collections lists. I found this great code on another thread but it doesn’t completely help me because my blog categories have well over 100 blog posts so I am working with more than one collection list on the page. So I need this code tweaked so that it will add each of the collection lists together.

You can see on my current site it is only counting 100 posts (which is the max for a collection) but i have well over 200 posts spread throughout 3 collection items. I’m not familiar enough with code to figure this out. Anyone have any ideas? THANKS!




blogNumber = $('.blog-post').length;


Code found from Code help - count number of cms items

anyone have any ideas?

Try changing your code to match your class names:


blogNumber = $('.post-card').length;

1 Like