Top 10 v2.3.0

I pushed through a major update of Top 10 – Popular Posts plugin for WordPress yesterday. It’s been over development for the past several months and adds many new features and fixes a huge number of bugs. Existing users should be able to upgrade directly from within your Dashboard > Updates screen in your WordPress admin area. If you aren’t tracking the popular posts on your blog, then take a look at Top 10. As usual, if you’re seeking support, please create a new post at the WordPress.org support forum. It is the fastest way to get support as I monitor the forums regularly. I also provide premium paid support via email.

More efficient tracker option

In older versions of Top 10, I used to use an external PHP/JS file to track counts. This was an efficient way and performed extremely well since it didn’t require loading the whole of WordPress. The flip side to this approach was that it needed to seek wp-load.php which isn’t always highly recommended because it might not work on non-standard WordPress installs e.g. when the wp-content folder has been moved.

In Top 10 v2.3.0, I’ve brought back this tracker and for new installs it serves as the default tracker. If you notice your posts not tracking, then this is the first setting that you should toggle. If you’re using any security/caching plugins, make sure that you whitelist /top-10/includes/top-10-addcount.js.php so that this is not blocked or cached.

Top 10 v2.3.0 - Tracker setting

View Popular Posts improvements

Top 10 v2.3.0 adds a new sub-menu item under the Top 10 screen. You can now access the daily (or custom period if you’ve set this to more than a day) popular posts directly from this menu item.

You’ll also note the addition of a new Filter dropdown and a search box on the popular posts screen. If you’re looking to find posts of a specific post type or containing a specific term then you can use this to search through the list of top posts. You’ll still be able to view the counts in the columns of your regular post / page or custom post type listing pages.

Top 10 v2.3.0 - View Popular Posts
Top 10 v2.3.0 – View Popular Posts

Functions and parameters

Some users of Top 10 have noticed that their theme’s didn’t contain have the_content function to include the post content. This was particularly when the themes were created solely for custom post types. You now have a new function tptn_add_tracker() to manually include the tracking code. This is simply a wrapper for tptn_add_viewed_count which filtered the_content.

I’ve also modified the main functions (and consequently the shortcode) that pulled the popular posts to now allow the post_types argument to accept a comma separated list of posts types. e.g. to display the popular list containing both posts and pages you can use the shortcode [tptn_list post_types="post,page"]. This allows you the flexibility to combine different types of shortcodes on a dedicated Popular posts page.

All things new in Top 10 v2.3.0

  • Features:
    • Preliminary support for PolyLang
    • Search box and post type filter added in Admin » View Popular Posts screen
    • Link to Daily Popular posts screen under Top 10 menu in admin area
    • post_types parameter now supports comma-separated list of post types. To fetch all built-in post types use ‘all’
    • New option to use the external and more efficient javascript file for tracking
    • New function tptn_add_tracker to manually include the tracking code
  • Enhancements:
    • Viewing drafts will no longer increment the counter
    • When using the Left Thumbs style, each widget instance includes the CSS code to display the correct thumbnail size
  • Bug fixes:
    • Missing DISTINCT keyword in query resulting in duplicate entries in some cases
    • PHP Notice in Widget on empty search and 404 pages
    • Incorrect notice that Contextual Related Posts is installed on Edit Posts pages
    • tptn_show_daily_pop_posts() without arguments did not display daily posts
    • Using Exclude categories returned incorrect counts and excluded non-posts
    • Incorrect count on the Admin » View Popular Posts screen causing incorrect pagination
    • Incorrect thumbnail size being pulled out in some instances
    • Multiple widget instances incorrectly used the same cache
    • Incorrect text domain was initialised