Skip to content
Menu
February 28, 2012

How to count your WordPress Plugins

capabilities covered
WordPress Amazon Web Services

As you may have noticed, we’ve been working on sharing some WordPress plugins with the community.  I like to check our profile page occasionally to see how our plugins are doing – download stats, forum posts, that sort of thing.

Like any other programmer, I also want to be able to say “Look!  All (y)our plugin are belong to us and have been downloaded X number of times!”  But the more plugins we write, the harder it is to figure out the total downloads, since they’re listed individually.

Enter javascript console:

[javascript]
(function($){
var sum = 0;
$(‘p.downloads’).each(function(i,o){
var $o = $(o)
, text = $o.text()
, count = parseInt( text.replace(‘ downloads’, ”).replace(‘,’, ”) )
;
sum += count;
});
var msg = ‘Total Downloads for User: ‘ + sum;
console.log(msg);
alert( msg );
})(jQuery);
[/javascript]

Voila! Bragging rights made easy!

capabilities covered
WordPress Amazon Web Services

The Atlantic BT Manifesto

The Ultimate Guide To Planning A Complex Web Project

Partner With Us

Ready for modern web technology and a sharp, user-friendly design? We want to give you exactly that. Contact us to get started.

Contact
  • This field is for validation purposes and should be left unchanged.