• Skip to primary navigation
  • Skip to main content
  • Skip to primary sidebar

WP SITES

2784

Original Genesis Tutorials & 6000+ Guaranteed Code

Snippets

  • Consultation
  • Full Access
  • Log in

2 Ways to Add Dynamic Number of Post Views With or Without a Plugin

This tutorial shows you 2 ways to display the number of times a post has been viewed in any theme position.

  1. The 1st method uses a plugin.
  2. The 2nd method uses code which is restricted to logged in members of WP Sites only.

1. Post Views Plugin

Lester Chan has developed one of the best plugins for displaying post views using one of many different methods.

Once you install the plugin, you can display the post view count using the plugins settings or call the function using a variety of methods.

Here’s the template tag you can add to any template file.

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

If you use a theme like Genesis, you can create a shortcode which you can then add to the post info using a genesis filter. The code for this solution is included in the 2nd method.

2. Add Post Views Using Code

This method provides the code you can simply add to your child themes functions file.

Then all you need to do is display the post views count using one of several easy to use methods included in the following code for members of WP Sites only.

Register for full access

Related Code Snippets

  • Add Post Count To Show Number of Views

Reader Interactions

Leave a Reply Cancel reply

You must be logged in to post a comment.

Primary Sidebar

Code written by Brad Dalton specialist for Genesis, WooCommerce & WordPress theme customization. Read More…

Advertise · WPEngine · Genesis · Log in

  • Access Problems
  • Account Details
  • Consulting
  • Tags