How to Display Most View Post in the template file?

The function getPostViews() is retrieving the total number of views for each post while setPostViews() increases the post views counter each time post is viewed.
You need to call setPostViews() somewhere in your single.php and then use below code to retrieve posts on basis of posts view count.

$args = Array(
  'post_type' => 'post',
  'posts_per_page' => '5',
  'meta_key' => 'post_views_count',
  'orderby' => 'meta_value_num',
  'order' => 'DESC'
);
$popular = new WP_Query( $args );

<?php while($popular->have_posts()) : $popular->the_post();  ?>

    <?php the_post_thumbnail(); ?> <?php the_title(); ?> <?php the_content(); ?>

<?php endwhile ?>

tech