Top 10 v2.4.0

This has been cross-posted on the WebberZone blog.

I’ve been working on Top 10 v2.4.0 for a long time where the main focus of this release has been to get a more compatible tracker. Today, I’m happy to say that I have pushed through the release and you can now upgrade your favourite popular posts plugin as you normally would from within your WordPress Dashboard Updates screen. This version adds two new features, fixes several bugs, has cleaner code as per WordPress Coding Standards and also deprecates some functions.

New tracker

Two months back I released v2.3.2 which fixed a security issue and also required me to remove the faster performance tracker. This was needed to ensure continued hosting with and respecting their guidelines. v2.4.0 is the first step towards building an addon that will bring back the faster tracker. This addon will be available for free from this website in the near future.

For now, you have two options for the tracker. Try both to see which delivers a better performance to your site. The first uses an external .js file that can be cached by browsers. The second is the old query style format. From my testing, both have similar performance. But, do toggle between both options to see which performs better. For the brave at heart, you can also adapt this gist which is the old source code for the faster tracker.

Now you can “offset” your posts

Another very useful feature that I’ve added in v2.4.0 is the ability to offset the list of posts by a specific number. This is available via the shortcode or in the widget.

Using the offset you can now display posts starting from a different position e.g. display posts from 11 to 20 by setting it to offset to 10. It also helps if you would like to display multiple versions of the widget with different starting points.

Top 10 v2.4.0 Widget
Widget in Top 10 v2.4.0

As usual, if you’re looking for support, please create a new post in the Top 10 support forum. And, do blog, tweet and tell the whole world about this release.

Detailed list of changes in Top 10 v2.4.0

  • Features:
    • New tracker using a properly enqueued .js file. Two inbuilt options to use query variables or ajaxurl to process the counts
    • Shortcode and the widget now have an added parameter for ‘offset’. This is useful if you would like to display different widgets/shortcodes but not always start from the first post
  • Bug fixes:
    • Attachments now work with the widget and elsewhere
    • New tracker now works when jQuery is loaded in the footer
    • Don’t add tracker code when previewing in customizer
    • Doesn’t report an error if no author is assigned to a post
  • Deprecated:
    • tptn_add_tracker and tptn_add_viewed_count have been deprecated. These should no longer be needed with the new tracker option.
    • wick script in Settings page which was used for fetching category slugs. You should now use the category name (prompted automatically). Slugs will be automatically converted into names.

Top 10 – Popular Posts for WordPress v2.1.0

Top 10 - Reset count and tools

Following on the heels of Contextual Related Posts v2.1.0 from last week, I’ve released Top 10 – Popular Posts for WordPress v2.1.0 with several bug fixes and many new features. If you’re using this plugin and looking for support, please do not post a comment below, but instead create a new thread in the support forum or create a new issue in Github.

Fix blog_id 0 errors

Top 10 - Reset count and tools
Top 10 – Reset count and tools

Top v2.0 introduced a bug where in some cases, hits on some posts were recorded in the database with an ID of 0. Also new installs didn’t have their database properly set up for this. v2.1.0 fixes both these issues. Additionally, I’ve added a new button at the bottom of the Settings page titled “Merge blog ID 0 and 1 post counts” which will convert all recorded posts with a blog ID of 0 to 1. The counts will be summed up and not replaced so you won’t lose the correctly recorded counts.

Bye bye Timthumb

Timthumb is completed deprecated from this version. It’s no longer bundled with the plugin. If you’d like to continue using timthumb, you’ll need to host it yourself and hook it into Top 10.

If you’re looking for a replacement to timthumb, do check out OTF Regenerate Thumbnails. It’s designed to regenerate images on the fly!

Custom Post Types in the Widget

You can now choose which post types to display in the widget. This will allow you to selectively choose top posts by custom post type. e.g. if you’re running a site with reviews which are registered as a separate post type, then you will be able to display the top visited reviews on your site.

Top 10 Widget
Top 10 Widget

New function get_tptn_pop_posts

I’ve introduced this new function that will allow you to fetch the new posts as an object (or alternatively as an array).

Just use <?php get_tptn_pop_posts(); ?> and you’re set to go. The function allows you to pass an amazingly huge set of arguments, i.e. everything that is available under tptn_default_options()

Are you using Top 10?

If you’ve been using Top 10, do consider writing a good review of the plugin on the This will encourage more users to try the plugin. Additionally, if you can, do consider a donation. Currently, that’s the only income that this plugin generates.

Complete list of changes in Top 10 – Popular Posts for WordPress v2.1.0:

  • New: Button in Top 10 settings page to merge posts across blog ID 0 and 1
  • New: Function & filter get_tptn_pop_posts that can be used to fetch the popular posts as an object or array. Perfect if you want to write custom code in your theme
  • New: Support for WPML to return the correct language ID. Thanks to Tony Flags’ code snippet.
  • New: Filter tptn_list_count to modify the formatted list count. See a working example
  • New: Post types can now be selected in the widget. This allows you to select top posts by post type
  • Modified: Plugin will attempt to pull the correct size image when fetching the first image in a post
  • Modified: Deprecated “Always display latest post count in the daily lists”
  • Modified: timthumb has been deprecated. The script is no longer packaged within Top 10
  • Fixed: Bug in tracking code when not using Ajax
  • Fixed: Bug in admin column did not check for the blog_id
  • Fixed: Bug where default thumbnail location was not correctly saved
  • Fixed: Incorrect thumbnail was pulled on attachment pages
  • Fixed: blog_id column of the database is correctly initialised as DEFAULT '1'

Top 10 Popular Posts for WordPress v2.0.1

It’s been nearly 6 years since I released v1.0 of Top 10. What started as a simple plugin to track your popular posts and display your top posts has evolved into one of the most popular “popular posts” plugins for WordPress used on thousands of blogs today! Versions between 1.0 and 1.9.10 have added support for thumbnails, custom post types, custom styles and more.

Today I unveil the latest, the greatest and the best version of Top 10 – The Popular Posts plugin for WordPress. v2.0.1 brings long pending support for WordPress multisite, better site compatibility and tracking, a cleaner admin interface and support for addons as well as some miscellaneous bug fixes. v2.0.1 also fixes a major bug that broke sites upgrading to v2.1.

The upgrade is available for all users from with your WordPress Admin. Remember to empty your caches from plugins like WP Super Cache to ensure that the new tracking scripts are added to your pages instead of the old tracking script. If you’re using Cloudflare, I recommend activating the Cache Fix in the settings page.

Top 10 - Popular Posts for WordPress

Here is what is new in Top 10 v2.0.1.

Continue reading “Top 10 Popular Posts for WordPress v2.0.1”

Top 10 v1.9.10.x

Top 10 Meta box

I pushed an update for Top 10 a few days ago which brings you some cool new features including the ability to edit counts, set thumbnails and improved shortcode options.

Following along the lines of Contextual Related Posts, Top 10 v1.9.10 brings a new meta box on your Edit Post / Page or Custom post type screen that allows you to set the custom thumbnail as well as edit the post count for the post.

Top 10 Meta box
Meta box on Edit screens will allow you to set the thumbnail and edit the post count

The meta box will use the same meta field as specified in the General Settings. If you’re using the default field name i.e. post-image and you’re using my other plugins Contextual Related Posts and Where did they go from here, then they will automatically recognise this thumbnail!

Another major change in the plugin is the use of the shortcode. You’re no longer restricted to three parameters as earlier, but all the options that can be passed to tptn_pop_posts(), which is all the settings that you can configure in the Settings page. Check out the function tptn_default_options if you’re curious for what is configurable.

The latest version of the plugin also brings the ability to turn off tracking for Editors. This is especially useful if you have a multi-user blog and Editors routinely edit posts and visit these posts.

As usual you can upgrade the plugin from within your WordPress admin. If you’re using Top 10, do consider giving it a 5-star review! If you got questions, please use the forum.

Emails and comments are not the best way to get support unless you’re willing to hire me to solve your problem related to Top 10!

Changes in v1.9.10.1

  • Fixed: Initialisation error for new installs

Changes in v1.9.10

  • New: Meta box on Edit post / page and similar screens that allow you to set the Top 10 (and my other plugins) specific thumbnail for the current post (different from the Featured thumb)
  • New: Admins can edit the number of total views (find it in the same meta box as above)
  • New: Turn of tracking for Editors
  • New: Added and to list of allowed sites for timthumb
  • New: Option to add quality settings for thumbnails created by timthumb
  • Modified: Shortcode now accepts all the parameters that tptn_pop_posts() can take. For a full list of parameters, please check out the FAQ.
  • Modified: Widget initialisation to latest standards
  • Fixed: Localisation initialisation
  • Fixed: Validation for hour and minute settings for the cron job
  • New: Several new filters allowing you to hook in an modify the output without editting plugin files
  • Modified: Reformatted code

Download Top 10 v1.9.10.1

Top 10 v1.9.9.1

A few hours back I uploaded a major release of Top 10, the top popular posts plugin for WordPress. This release adds several new features and I have hopefully squashed many pending bugs.

First of all, the admin interface has received a major overhaul. It should flow better with the rest of your WordPress interface and should be more responsive especially on smaller screens and mobile devices. I’ve also cleaned up the text on many of the options and added explanations to several of the options in a hope to address many of the repetitive questions that I have been receiving. This release also includes new shortcodes and a better maintenance program. With the new maintenance program, only entries older than 90 days are cleaned from the hits table unlike the older version where the daily counts were reset on each run.

The best new addition to this version of the plugin is the addition of a new default style for the popular posts. Top 10 was covered by WPMUDev two weeks back and this was one of the key suggestions.

Check out the detailed list of changes below. As usual, if you have a problem with the plugin, please create a post in the Support Forum. Top 10 is also on Github, so if you’re interested in submitting a patch or change do consider forking the plugin and creating a pull request.

If you’re an existing user, you should be able to update the plugin from within you dashboard. If you’ve not tried Top 10 yet, install it and you won’t switch over to any other.

If you’ve got a caching plugin like WP Super Cache, you will need to clear the cache files in order to ensure that the new plugin code kicks in.

Top 10 v1.9.9

Changes in Top 10 v1.9.9

  • New: Default style to make those popular posts a little pretty. Choose Thumbnails inline, before title under ‘Thumbnail options’
  • New: Option to disable display of counts to non-admins. Check out the option ‘Show number of views to non-admins’
  • New: Option to display different text when there are no hits on the post on non single posts e.g. home page, archives, etc.
  • New: Class tptn_posts_widget for the widgets
  • Modified: Brought back the old columns “Views” in the Admin Posts and Pages which contains both the Overall and Daily counts
  • Modified: New admin interface keeping mobile first in mind
  • Modified: Optimised widgets loading
  • Modified: Cron job will now delete entries from the daily table older than 90 days
  • Fixed: mySQL error messages due to improper escaping
  • Fixed: Plugin no longer overwrites cron schedules
  • Modified: Lot’s of code optimisation and cleanup

Changes in Top 10 v1.9.9.1

  • Fixed: Maintenance cron job error

Top 10 v1.9.8

New in Top 10 v1.9.8

I uploaded v1.9.8 and of Top 10 plugin for WordPress. If you’re an existing user, you’ll be able to upgrade the plugin from within your WordPress Admin interface itself.

Changes in this version include:

  • New: Custom post support. Choose which custom post types to display in the top posts
  • New: More display options. Select which archives you want to display the post count
  • New: Option to open links in new window
  • New: Option to add nofollow attribute to links
  • New: Option to exclude posts by ID in the list of top posts being displayed
  • New: Option to prevent display of the Visit Count on posts by ID
  • New: Option to choose between using CSS styles or HTML attributes for thumbnail width and height. HTML width and height attributes are default
  • New: Option to restrict the title to fixed number of characters
  • New: Option to add the date to the list
  • Modified: Numbers are now formatted based on the locale
  • Fixed: Plugin will now create thumbnails from the first image in gallery custom posts

New in Top 10 v1.9.8

If you haven’t heard of this plugin yet, Top 10 will count the number of page views on your single posts on a daily as well as overall basis. You can then display the page view count on individual posts and pages as well as display a list of most popular posts based on page views. Includes a sidebar widget to display the popular posts. And, all settings can be configured from within your WordPress Admin area itself!

Download Top 10 v1.9.8.1

Top 10 v1.9.3 and v1.9.4



Following quick on the heels of Contextual Related Posts v1.8.7, I’ve uploaded Top 10 v1.9.3 to the plugin repository.

Top 10 will count the number of page views on your single posts on a daily as well as overall basis. You can then display the page view count on individual posts and pages as well as display a list of most popular posts based on page views.

This is an important update that fixes a potential XSS vulnerability in the settings page plus some bug fixes. I’ve also added two new classes for styling the widgets.

If you’ve any questions please do use the support forums, as they are the best mode to receive support as I monitor them daily. If you’re a user of Top 10, do leave a good review for the plugin.

Changes in 1.9.3 and 1.9.4

  • Important security update: Fixed possible XSS vulnerability
  • Fixed: Exclude categories was not excluding posts correctly
  • Added: Classes tptn_posts and tptn_posts_daily for the widgets that let you easily style the lists

Top 10 v1.9 and v1.9.1

Top 10 widget

The latest version of my popular posts plugin Top 10 is now available for download. Existing users can quickly upgrade this from within your WordPress Dashboard. New users can get the plugin by searching for “Top 10” from Plugins > Add New.

Top 10 will count the number of page views on your single posts on a daily as well as overall basis. You can then display the page view count on individual posts and pages as well as display a list of most popular posts based on page views.

 New WordPress widgets

If you’ve been using the Top 10 WordPress widgets, you’ll notice that you can now customise the widgets. This version consolidates both widgets into a single one and you have several different options available to you.

Top 10 widget

Change the drop down from Overall to Custom Time Period and you can switch to the Daily widget. Note that this upgrade will require you to re-add the Daily widget and update the preferences of your normal Popular Posts widget.

Custom CSS

If you’ve been using my other plugin Contextual Related Posts, you will be familiar with this option. You can add your own custom CSS code here that will allow you to style the output of the plugin. Check out the FAQ for various CSS classes and IDs available to style.

Top 10 Custom CSS

Maintenance options

Using this period of a long period of time causes your daily posts database to accumulate a lot of historic data. This has its performance impact, especially on highly active sites.

v1.9 brings you the option of regularly cleaning up the daily posts database at fixed intervals of time.

Top 10 - Maintenance

Future versions will include a more advanced cleaner that will retain select amounts of historic data.

If you’re using more than 1 Day as your “Daily” option please do not use the scheduler as this resets the daily table when run.

Note: WordPress automatically executes the cron job when it is scheduled the first time. Hitting “Save Options” will clean your daily post table when the options are saved if you have the “Enable scheduled maintenance” active.

If you have any support questions, please post these in the support forum.

Summary of changes in v1.9

  • Added: Option to use timthumb to resize thumbnails
  • Added: New variable %overallcount% that will display the total pageviews on the blog across all posts
  • Added: Post thumbnails are now properly resized based on width and height settings in the Top 10 settings page
  • Added: Customise what to display when there are no top posts detected
  • Added: New scheduled maintenance to clear up daily tables and optimise performance
  • Added: Custom CSS code to style the output. Check out the available styles in the FAQ
  • Modified: New “default.png” file based on from KDE’s Oxygen icon set
  • Modified: Dashboard list of posts now displays all the top posts and pages instead of the filtered list based on Settings.
  • Modified: Dashboard widget now has options to customise the widget. Old widgets have been deleted
  • Modified: When fetching the first image, plugin ignores external images
  • Modified: Minor performance tweaks

Summary of changes in v1.9.1

  • Fixed: Plugin will now only reschedule the cron job if there any settings are changed related to it
  • Modified: If timthumb is disabled, WordPress post thumbnails are no longer resized using timthumb
  • Modified: Extra check for post featured thumbnails to ensure that the src is not missed


Contextual Related Posts and Top 10 updated

I was going through a rather interesting post that Jeff made on WP Tavern. There has been a lot of discussion about credit links in plugins and themes. While themes have been more painful due to the links being misused for sponsored links.

Both Contextual Related Posts and Top 10 have credit links, where I provide the user the option to turn off the credit link. In this version of both these plugins I have changed the default option to off. This means that the plugins on first installation will no longer link back to my site.

However, this option will not change if you upgrade. So, you’ll need to manually turn it off if you don’t want the link.

Again, need I say that I would highly appreciate if you turn on the option. Alternatively, if you’re using the plugin, can I ask you to make a post on what you like about it?

Top 10:

WordPress doesn’t count page views by default. Top 10 will count the number of page views on your single posts on a daily as well as overall basis. You can then display the page view count on individual posts and pages as well as display a list of most popular posts based on page views.

Contextual Related Posts:

Display a list of contextually related posts for the current post. You can select the number of posts to display and if you want to automatically display the related posts in your content / feed.

I’m still looking for translators for both these plugins. If you are interested in translating this plugin, please do contact me.

I’ll also be releasing an update to Where did they go from here? sometime this week with similar changes.

Bug fix releases for Contextual Related Posts and Top 10

Just released two bug fix updates for two of my plugins:

Top 10

Track daily and total visits on your blog posts and display the count as well as popular posts.

Contextual Related Posts

Display a list of contextually related posts for the current post.

Changes to Contextual Related Posts:

  • Fixed: Custom output was not detecting styles properly
  • Fixed: Incorrect XHTML code was being generated when using special characters in the post title
  • Added German translation

Changes to Top 10:

  • Added: You can now use HTML in the counter display