Skip to content
Mc Starters Main Logo Circle
  • Home
  • CompanyExpand
    • About Us
    • Meet with Team
    • Media Assets
    • We’re Hiring
    • Contact Us
  • Top CategoriesExpand
    • WooCommerce
    • Elementor
    • Webflow
    • Divi
    • WordPress
    • SEO
    • Payoneer Guides
    • Shopify Tutorials
    • Squarespace
    • Weebly
    • Wix
    • Website Builders
    • CRM
    • Payment
  • Tips and TricksExpand
    • AI
    • Business
    • Insurance
    • Resources
    • Review
    • Science and Technology
    • Windows 10
    • Windows 11
  • ServicesExpand
    • WordPress Web Design
    • Elementor Expert
    • Divi Theme Experts
    • Blog Setup
    • WordPress Customization
    • E-Commerce Websites
    • Crocoblock Expert
    • Hire Webflow Expert
  • Free TemplatesExpand
    • Elementor Templates
    • Elementor Header
    • Elementor Footer
    • Elementor Single Post Templates
    • Elementor Mega Menu
    • Divi Templates
    • Divi Header Layouts
    • Divi Footer Layout
  • Tools
  • Guest Posts

Lifetime Pro Access to Elementor & Divi Templates

Grab deal
Mc Starters Main Logo Circle
Home / WordPress / How to Display Total Views on Your WordPress Posts: A Step-by-Step Guide

How to Display Total Views on Your WordPress Posts: A Step-by-Step Guide

Published By :Iram S. December 5, 2023January 10, 2024 WordPress
How to Display Total Views on Your WordPress Posts A Step-by-Step Guide

Do you want to display total views on WordPress posts? Here a quick methods to display post views with plugins and without plugins.

Displaying post views on WordPress posts to add value to your services. If you give the product review or any advertisement is a great fit to show the post views. In this way, every visitor sees your traffic and may be impressed to reach out to discuss pricing or details.

You can easily display post views counter up or bottom of the blog post, where you want.

Let’s get started:

Display Post Views With Plugins

If you do not know the coding or technical skills, you can display the total views on WordPress posts with plugins.

Post Views Counter

Post Views Counter

Post views counter is a compatible and reliable plugin that you use to display post views or visitors. It can pull the data in different ways, what you want to like. Go to the plugin’s display settings, and customize the style or positions of the view counter.

Page View Count

Page View Count

Page view count displays the number of page and post views. Go to plugins display settings and change the design of the plugins just show the post views. It can increase the engagement of the users. You can change the color according to color themes.

Display Post Views Without Plugins

You can display the page views with code by making a just few changes in themes.

To add code to your WordPress site for displaying post views, follow these steps:

Step 1: Log in WordPress admin dashboard.

See also  What is Squeeze Landing Page ( 10 + Free Squeeze Pages Templates )

Step 2: Go to Appearance, then open Theme Editor.

Step 3:Open the functions.php file.

Step 4: Copy and paste the these code before the closing tag ?>:

function gt_get_post_view() {
    $count = get_post_meta(get_the_ID(), 'post_views_count', true);
    return "$count views";
}

function gt_set_post_view() {
    $key = 'post_views_count';
    $post_id = get_the_ID();
    $count = (int) get_post_meta($post_id, $key, true);
    $count++;
    update_post_meta($post_id, $key, $count);
}

function gt_posts_column_views($columns) {
    $columns['post_views'] = 'Views';
    return $columns;
}

function gt_posts_custom_column_views($column) {
    if ($column === 'post_views') {
        echo gt_get_post_view();
    }
}

add_filter('manage_posts_columns', 'gt_posts_column_views');
add_action('manage_posts_custom_column', 'gt_posts_custom_column_views');

Step 5: Open the single.php file in the theme editor.

Step 6: Copy and paste this code in the while loop (use CTRL + F or Command + F to find it in the file):

<?php gt_set_post_view(); ?>

This code is responsible for incrementing the views count each time a post is viewed.

Step 7: Copy and paste this code where you want to display the number of posts or page views:

<?= gt_get_post_view(); ?>

This will display the views count on the front end of your site​​.

By adding this code to your WordPress site, you will be able to track and display the number of views each post receives, which can be valuable for understanding the popularity and reach of your content.

WordPress post view count not working

If your WordPress post view count is not working, there could be several reasons for this issue. Here are some steps you can take to troubleshoot and resolve the problem:

  1. Update the view count plugin and check its settings.
  2. Clear both the website and browser cache.
  3. Temporarily switch to a default WordPress theme.
  4. Check for JavaScript errors in the browser console.
  5. Consult your hosting provider about server-side restrictions.
  6. Ensure WordPress and PHP are up to date.
See also  How to Increase icon size within toggle widget Elementor

conclusion

In conclusion, displaying total views on WordPress posts involves adding custom PHP functions to your WordPress theme. These functions are responsible for tracking the number of times a post is viewed and displaying this count on the front end of your website.

By editing the functions.php file, you introduce a system to increment view counts and retrieve them for display. Additionally, the code can be extended to modify the WordPress admin dashboard, allowing view counts to be visible in the post-management area. This feature enhances the functionality of a WordPress site by providing valuable insights into post popularity and engagement.

Post Tags: #WordPress#Wordpress guide#WordPress Posts

Best VPN Services Cheapest Hosting converkit convertkit Create Custom Header Credit Cards CRM Software customization tips Customize Elementor Styles Detailed Comparison divi guide divi tips Elementor Error Elementor Guide Elementor mega menu Elementor Pro Elementor Templates Elementor tips email marketing tools Hosting service Insurance Industry integrate Elementor Form Managed hosting Marketing tools comparsions mega menu design NordVPN payment tips SEO guide Shopify speed optimization tips & trick tools for small business Top CRM System webflow guide Webflow Tips Website builder Website navigations Woocommerce tips WordPress wordpress developer Wordpress guide wordpress guides WordPress Maintenance services WordPress plugin Wordpress support

Facebook FacebookTwitter TwitterInstagram InstagramPinterest PinterestYouTube YouTube

© 2025 Mc Starters Blog

  • Guest Posts
  • HTML Sitemap
  • XML Sitemap
  • Affiliate Disclosure
Scroll to top
  • Home
  • Company
    • About Us
    • Meet with Team
    • Media Assets
    • We’re Hiring
    • Contact Us
  • Top Categories
    • WooCommerce
    • Elementor
    • Webflow
    • Divi
    • WordPress
    • SEO
    • Payoneer Guides
    • Shopify Tutorials
    • Squarespace
    • Weebly
    • Wix
    • Website Builders
    • CRM
    • Payment
  • Tips and Tricks
    • AI
    • Business
    • Insurance
    • Resources
    • Review
    • Science and Technology
    • Windows 10
    • Windows 11
  • Services
    • WordPress Web Design
    • Elementor Expert
    • Divi Theme Experts
    • Blog Setup
    • WordPress Customization
    • E-Commerce Websites
    • Crocoblock Expert
    • Hire Webflow Expert
  • Free Templates
    • Elementor Templates
    • Elementor Header
    • Elementor Footer
    • Elementor Single Post Templates
    • Elementor Mega Menu
    • Divi Templates
    • Divi Header Layouts
    • Divi Footer Layout
  • Tools
  • Guest Posts
Facebook X Instagram YouTube Pinterest
Search