Streaming live at 10am (PST)

Code to count number of posts in multiple collections


#1

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!

30%20PM

LINKS:


https://preview.webflow.com/preview/jegstech?preview=c28d2d535e4140f60458bb61d3b43325

<script>

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

</script>]

Code found from Code help - count number of cms items


#2

anyone have any ideas?


#3

Try changing your code to match your class names:

<script>

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

</script>