Is it a way to get posts published between a date and today with query_posts()
?
Example : All posts published since 2012-04-01
Thanks
EDIT :
How to add the filter date on this Query Posts ?
query_posts( array(
array('post'),
'tax_query' => array(
array(
'taxonomy' => 'post_format',
'field' => 'slug',
'terms' => array('post-format-image')
)
),
'cat' => '-173',
'post_status' => 'publish'
) );
UPDATE December 23 2014
There is a better method using
date_query
property ofWP_Query
class:OLD ANSWER
Use the Time Parameters in WP_Query()
Quoting example from the Codex:
Return posts from the last 30 days:
Edit
(in response to the OP’s updated question).
Avoid using query_posts. You can use the above technique to alter your main query (subject to some extra conditionals – is home page, is a page called ‘foobar’ etc. ):
If you wish to get posts between two dates, then use the before and after parameters in the date_query parameter,
As of 3.7 you can use date_query http://codex.wordpress.org/Class_Reference/WP_Query#Date_Parameters
So the args passed would look like: