How to add post view on WordPress using a WordPress Plugin.
Click to copy the code
<?php if(function_exists('the_views')) { the_views(); } ?>
A WordPress plugin is such a lifesaver.
WordPress plugin provides a one-click help whenever you want to add a new feature or functionality to your website.
With A WordPress plugin, you don’t have to know a single line of code to manage your WordPress website.
In this short beginner WordPress tutorial, I will show you how to add a post view counter to your WordPress posts.
I also recorded this short tutorial in a video. If you prefer to see it in the video, then watch it below;
Post view counter is a great functionality that should be on your post and your pages so that you can know how many people are reading your posts.

Views from this data help you quantify how much traffic your blog posts and web pages are getting firsthand.
So in this tutorial, I will show you 3 simple steps to add this functionality to your WordPress website.
So if you’re ready, let’s get started.
Install WP post view plugin
Login to your WordPress admin dashboard
Come to the plugin section of WordPress
Click on add new

Come to the search plugin, type in wp post view, and click on enter.
Look out for the wp Post view.

As you can see, this has over 100,000 active installations and a five-star rating. This shows that this is a safe plugin to install.
Click on install now, and once installed, click on activate.
WP settings
Once the WP post view plugin has been activated;
Go to the settings section as appeared below
Search for post views
Click on post views.

Alright. Here we’re going to effect some settings to our WordPress plugin so that it can give us our desired result.
Come to the post view and click on the drop-down button. Select everyone

Leave every other thing as it is, and then click on save changes.
Add a snippet code
We will add a bit of a snippet code to our WordPress website.
Don’t worry, it’s a simple process. Let’s do it.
The first thing to do is to go to our post and view our post-Metadata.
Click on view. I’m going to do that in a new tab.

This is the post I’m using just as a demo post for this tutorial.
Highlight this metadata here, that’s the date here.
Right-click your mouse and click “Inspect”


What we want to do here is to know the name of our metadata.
Once you’re here, the span class will be highlighted automatically.

What we want to do here is to look for the name of the div class of our post metadata.
So, what you will do is that from here you’ll just keep pointing your arrow upward until we get to the div class.

Alright, so you can see what I have here.
You can see the div class, and as I point at it, you will see that our metadata and our post title are being highlighted.
So we want to take note of this div class name.

There’s every possibility of course, that your own name may not be exactly what I have on mine. So, make sure that you highlight this name and note it somewhere.
Once we note the name, we will add that snippet code in our function.Php file.
Return to WordPress dashboard
Let’s return to our WordPress dashboard
Come to appearance. Scroll down to theme editor
Select your theme. I used the Divi theme on this website. I’m sure you might be using some other theme, it will not matter.
Come to functions.PHP here and click on it.

Scroll down and come to single post.PHP like we have here single.PHP
Click on it

We will look for the name we have noted down previously. Look for it here in the single post.PHP
Scroll down and look for that div class and locate the name


Enter a new line and post this line of code
Copy code below
<?php if(function_exists('the_views')) { the_views(); } ?>

Update file.
Return to your post. Refresh the page.

If you complete this process, you can see your post views.
This is how to add post view on WordPress using a simple WordPress plugin.
In the video below, I further show you how to format and customize your metadata as a follow up to this turorial. Check it up below.
0 Comments