Mecha CMS

Mecha CMS blog and documentation.

Page Views Counter Plugin

Updated: Sunday, 07 August 2016

Count your page views with this plugin.

Image

This plugin will count the number of your page visits. Your page visits will not be counted if you’re logged in.

Widget Installation

Put this widget code on your article.php, page.php or index.php file:

<?php echo Widget::pageViews(article-or-page-slug, 'Views'); ?>

Example for article.php

<footer class="post-footer">
  <?php echo Widget::pageViews($article->slug, 'Views'); ?>
</footer>

Example for page.php

<footer class="post-footer">
  <?php echo Widget::pageViews($page->slug, 'Views'); ?>
</footer>

Example for index.php

<?php foreach($articles as $article): ?>

…

<footer class="post-footer">
  <?php echo Widget::pageViews($article->slug, 'Views'); ?>
</footer>

…

<?php endforeach; ?>

Download Latest Version

Donation and Email Subscription