Total Views on WordPress Posts

Website Tutorial

How to Display Total Views on WordPress Posts

How to Display Total Views on WordPress Posts Place the code in your functions.php file function getPostViews($postID){getPostViews(get_the_ID()); $count_key = 'post_views_count'; $count = get_post_meta($postID, $count_key, true); if($count==''){ delete_post_meta($postID, $count_key); add_post_meta($postID, $count_key, '0'); return "0 View"; } return $count.' Views'; } function...