Get Page Views Number in a Theme Template

If you are using the  Pageviews Add-On, you can can show the page views number anywhere in your website.

To do so you need to add the following code into your theme template files:

    global $post;
    echo get_post_meta($post->ID, 'mashpv_pageviews_count', true);

You can paste the code for example into single.php, category.php or anywhere else where you like to show the pageview counter. Just make sure that you are pasting the code within the loop function where the $post object is available.

Still need help? Contact Us Contact Us