Hi, would it be possible to automatically create a new repeater row each year and then include the number of posts there were that year? Ideally pull the date for the posts from an ACF date field. I currently use the below snippet to count my total posts, hopefully this could be a starting point.
You could do this by doing a query based on the date field, there are examples of this available. Then if you have a repeater somewhere, like on an options page, you can add rows to that repeater.
But this sounds a little complicated to me to track how many posts there are per year. I would more than likely create a WP options value that contains an array and track how many posts are created for each year as they are created or updated. If I need to do this retroactively then I’d find a way to get and populate this list and then start adding to it.
Viewing 2 posts - 1 through 2 (of 2 total)
You must be logged in to reply to this topic.
Welcome to the Advanced Custom Fields community forum.
Browse through ideas, snippets of code, questions and answers between fellow ACF users