How to display number of page views on a post?

Try this
Works on single site

// post views
function setAndViewPostViews($postID) {
    $count_key = 'views';
    $count = get_post_meta($postID, $count_key, true);
    if($count==''){
        $count = 0;
        delete_post_meta($postID, $count_key);
        add_post_meta($postID, $count_key, '0');
    }else{
        $count++;
        update_post_meta($postID, $count_key, $count);
    }
    return $count; /* so you can show it */
}

You need to add the following function to your theme’s functions.php and call it inside the loop or inside your posts.php or page.php of your theme. like so

<?php echo setAndViewPostViews(get_the_ID());  ?>

This will increment and persist the post’s count then show the number of views.

Got inspiration from the question and did a write up if it might help anyone http://nerudo.mregi.com/how-to-display-number-of-page-views-on-a-post-wp/