I’m want to get posts from the last 30days in a sidebar but I don’t want to use query_posts, is there a way to achieve this with the get posts function?
Leave a Reply
You must be logged in to post a comment.
I’m want to get posts from the last 30days in a sidebar but I don’t want to use query_posts, is there a way to achieve this with the get posts function?
You must be logged in to post a comment.
Yes, simple add a filter before you call it and remove it after you do
notice the
'suppress_filters' => false
which is what makes this happen withget_posts
As of 3.7 you can use date_query http://codex.wordpress.org/Class_Reference/WP_Query#Date_Parameters
So it would look like: