pgatroy
Member
Posted 4 years ago #
I would like to create a template page which pulls posts from a certain category according to a specific date range.
Can someone please provide me with the code to do this? I know how to pull certain categories but don't know how to filter by date range.
Thank you.
Read this codex reference on query_posts.
Example 2 is probably what you are looking for, then scroll down to time parameters.
Example 2 doesn't address a range, but rather just a specific date, month or year. For instance, I am using future-is-now and want to be able to retrieve the next 3 posts dated later than today. How would you do that?
Try with these threads about displaying future posts http://wordpress.org/tags/futureposts
There, I found this link, which may have your solution. Maybe you can adapt the code to your needs?
http://www.keithmillington.co.uk/wordpress/?p=22, then add &showposts=3 to limit the number of posts.
Hope this helps.
I need this as well. The answers posted so far are close, but don't actually address the "range" issue. All I need is a list of all the posts in all categories posted in the last seven days. can someone please help?
thanks,
e.