Replicate the_date function when using a custom field
You can use date_query with is very usefull. In this snipet we get a week most viewed posts. <?php $args = array( ‘date_query’ => array( array( ‘year’ => date(‘Y’), ‘week’ => date(‘W’), ), ), ‘post_type’ => ‘post’, ‘post_status’ => ‘publish’, ‘meta_key’ => ‘post_views_count’, ‘orderby’ => ‘meta_value’, ‘order’ => ‘DESC’, ‘showposts’ => ‘5’ ); $my_query = … Read more