As your question does not state, I’m assuming that this is not your main query, but rather a stand alone that tells the visitor the most viewed page of the day.
Therefore I believe that an instance of the WP_Query
class is what you need.
/** Query the posts to find the one with the most views from today */
$today = getdate();
$args = array(
'meta_key' => 'post_views_count',
'orderby' => 'meta_value_num',
'posts_per_page' => 1,
'post_type' => 'post',
'post_status' => 'publish',
'date_query' => array(
array(
'year' => $today['year'],
'month' => $today['mon'],
'day' => $today['mday']
)
)
);
$my_query = new WP_Query($args);
echo '<pre>$my_query: '; print_r($my_query); echo '</pre>';
/** Check for results and output them */
if($my_query->have_posts()) : while($my_query->have_posts()) : $my_query->the_post();
/** Your code goes here, inside The Loop */
echo '<pre>' . get_the_title() . ' (' . get_post_meta(get_the_ID(), 'post_views_count', true) . ')' . '</pre>';
endwhile;
wp_reset_postdata();
endif;