WordPress Plugin: How To Add Post View On WordPress

Good? Please share

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. 

wordpress plugin

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 

wordpress plugin

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

Look out for the wp Post view.

wordpress plugin

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. 

wordpress plugin

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 

wordpress plugin

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.

How To Add Post View On WordPress

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”

How To Add Post View On WordPress

How To Add Post View On WordPress

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.

How To Add Post View On WordPress

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. 

How To Add Post View On WordPress

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.

How To Add Post View On WordPress

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.

wordpress plugin

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

Click on it 

wordpress plugin

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

wordpress plugin

How To Add Post View On WordPress

Enter a new line and post this line of code 

Copy code below

<?php if(function_exists('the_views')) { the_views(); } ?>




How To Add Post View On WordPress

Update file.

Return to your post. Refresh the page. 

How To Add Post View On WordPress

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.

Other WordPress tutorials

Suggested WordPress Articles

0 Comments

Submit a Comment

Your email address will not be published. Required fields are marked *