[How-To] Show Number of Page Views on Post Pages in WordPress


I’ve been asked by so many bloggers unlimited times – how did you manage to show that number of views just under post title in post pages. If you get to notice that there is a counter of number of page views of the opened post, beside the author’s name and published date.

Well there’s no coding behind, or no trick involved. It’s a tiny plugin called “WP-PostViews” that does the job.

Click here to download PostViews (direct download link), if you wish to manually install the plugin. Or you can search and install directly from “add new plugins” page in your WP dashboard. Just search for “postviews” and intall the one with title “WP-PostViews” (author: Lester ‘GaMerZ’ Chan)

Currently the version is 1.50 and it fully supports WordPress v3.0.3.

After installation, you’d see it under settings panel, from where you can set the templates of the page views count and most viewed template. You can optionally set the number of views viewable to certain group of users. You can set it to viewable to everyone, guest readers or registered users.

Wp-PostViews Options and Settings
I’d recommend to leave the template setting to default. But you can offcourse change this if you need and you are sure what you’re doing.

Scroll down the page to see “Display Options” where you can optionally set the display settings of the plugin. You can choose between “Everyone”, “Registered users” and “Search pages”. Again leaving it to “everyone” is recommended as this adds all the views of the particular post if it is displayed on a search page.

Wp-PostViews Display Options

Above were just the settings of the plugin now comes the installation part. To view the number of views literally ANYWHERE on your blog, all you need is just to put this function call:

<?php the_views(); ?>

In my case, I put it just under the title of post page, therefore it should pe pasted in “single.php”.

Wp-PostViews Installation in code

You can choose any place where you want it to appear, no matter if it’s the sidebar, header or footer.

So this was the simple method to show the number of views of your blog posts in your wordpress blog through Wp-PostViews plugin. A very useful plugin if you need to know and publicize the number of views of all your blog posts. It’s little lighter than other version of similar plugins plus the installation is pretty simple as well.

If you use some other plugin or method to show number of views per posts then I’d like you to share your way of doing this in the comments below.