How could wp-query be used to show posts month by month, and have it only show the past year? Or is it possible some wp_archive hack could handle this?
Leave a Reply
You must be logged in to post a comment.
How could wp-query be used to show posts month by month, and have it only show the past year? Or is it possible some wp_archive hack could handle this?
You must be logged in to post a comment.
WordPress 3.7 introduced the
date_query
to display posts month by month:Note : $month refers to month number (1-12)
Well it’s not a hack it’s a function. You can simply use
wp_get_archives
http://codex.wordpress.org/Function_Reference/wp_get_archives
Alternatively you can use a
wp_query
with a time format for actual content, for instance,http://codex.wordpress.org/Class_Reference/WP_Query#Time_Parameters
Try this, I should clarify that the code is based on a snippet that I saw.