Popular Posts

New WordPress Plugin: Top 10

Last week I gave you Contextual Related Posts and Moderation Author Notify. Have spent almost the whole of this week rewriting Mark’s original Top 10 plugin. And, that sure has been a rather interesting, frustrating and of course fulfilling journey in PHP in general and WordPress in particular and I still believe I’ve not even scratched the surface of PHP, SQL and WordPress!

Anyway, I began with duplicating the original functionality of the plugin, however, ensuring that this strictly followed the latest Plugin API recommended by WordPress.

So, a few things that were changed / added were:

  • The table to store the statistics now has the prefix (wp_) by default. So, if you have multiple blogs stored in the same database with different prefixes, this plugin will not mess up the stats.
  • An options page to set the text you want displayed for the counter as well as for the popular posts
  • Uninstall support so that all changes by the plugin are reversed on deletion from within WP-Admin. But, why would you?
  • Ability to automatically add the viewed count to your single posts and pages.

Having all this in place, I ran a test on my blog Techtites and was pleased with the results, except for one major bottleneck. With WP Super Cache disabled the plugin tracked page views and displayed the counts correctly. However, the moment I enabled the cache the plugin would no longer update, and the page views were singe.

Read More »New WordPress Plugin: Top 10