Thursday, 11 February 2021 16:15

Automatically Hide Article Count for Articles with Low Traffic

Written by

Deciding whether or not to show the number of or "hits" or "views" that an article has received is easy with Joomla: you toggle them globally, and on a per-article basis. So if you have an blog with relatively low traffic, but you have a popular article where you want to show how a hit counter, it's easy: disable the view count globally and enable it for the individual article.

After a while, this starts to get old, because you generally post an article without the hit counter showing and then if it gets a lot of traffic, you want to turn it on.

With this in mind I decided to write a quick custom script.

The original code looks something like this:

<?php if($this->item->params->get('itemHits')): ?>

 

 

The new code:

<?php 
// declare new "hit" variable
$c2hits=$this->item->hits;
?>

<?php if($this->item->params->get('itemHits') && $c2hits > 100): ?>
Last modified on Thursday, 11 February 2021 16:22

Latest Comments

Got a similar email that seemed suspicious. Ignored it and they even followed up today.
My organization received one of these emails from "Linda," but uses https://www.bestprosintown.com/p...
Angela Snowman posted a comment in Link Building SEO Directory Scam Alert: loc8nearme.com
Hi Nate, I got the same email template from the same email address today and found you through a ...
Just received one today (16 Aug 2022) from "Mailchimp". Thanks for sharing!
Thanks for posting this. I just got one today. I was 99% sure it was a scam, and your post confirmed...


Design & Development

Wordpress, Drupal, Joomla
New custom websites
Bespoke themes and extensions
Redesigns, upgrades, migrations

Web Design & Development


Optimization & SEO

Let us optimize and manage your overall online presence. We offer full service monthly SEO as well as one-time projects.  

Optimization Plans & Pricing


Maintenance, Patching

White glove monthly backups, security updates, maintenance and testing for your Wordpress, Drupal, or Joomla site.

Maintenance Plans & Pricing


Email Newsletter

Bring your web & marketing performance to the next level: monthly blog post roundup via email.  

Stay in Touch!