I have a code which sorts the content by most liked, but I would like it to show the most liked in between previous week monday and next week monday. And the posts must be published in that time frame. Tho I have no idea how to sort by published date and most liked in that time frame. Grateful for help if anyone can. Using Ulike plugin to pull likes.
$loop = new WP_Query(
array(
'posts_per_page' => 6,
'post_status' => 'publish',
'post_type' => 'post',
'orderby' => 'meta_value_num',
'meta_key' => '_liked',
'date_query' => array(
array(
'after' => strtotime( 'monday previous week' ),
'before' => strtotime( 'monday next week' )
),
),
'paged' => (get_query_var('paged')) ? get_query_var('paged') : 1
)
);
while ($loop -> have_posts()) : $loop -> the_post();