I have a custom post type called "papers", and, to feed a chart, I need an array of the number of posts per year that have posts.
I’ve tried with wp_count_posts()
but it just give me the total number of post types, and get_archives()
is just to static, and I need to use specific information like the number of post per year.
Does anyone know how to do this? Hope you can help me.
2
Answers
For anyone who has been wondering the same thing, I got it from other forum:
Get the complete answer here: https://wordpress.stackexchange.com/questions/395928/get-an-array-of-the-number-of-post-per-year-of-a-custom-post-type-wordpress/396047#396047
To get posts published from last year
Other different ways
This will output the following
2015 (5)
2014 (3)
2011 (10)