I am trying to loop through all the post to get the top most shared posts on social network. I want to use the date_query
parameter in the WP_query
to get the posts of last two days , last 5 days, last 7 days and last 9 days. How can i implement it through using the date_query
in WP_Query
My WP_query
is
<?php
$args = array(
'post_type' => 'post',
'order'=>'DESC',
'posts_per_page' => 1,
'date_query' => array(
array(
'after' => '10 days ago',
'inclusive' => true,
),
),
'orderby'=>'meta_value',
'meta_key'=>'esml_socialcount_TOTAL'
);
$the_query = new WP_Query($args);
if($the_query->have_posts()) {
while ($the_query->have_posts()){$the_query->the_post();
?>