Top 10 – Popular Posts for WordPress v3.3.0
I’m pleased to announce the latest version of Top 10 – Popular Posts for WordPress, the ultimate plugin to showcase your most popular content. I have completely rewritten the plugin code in this version using classes and autoloading. This update also brings several new features and enhancements to make your experience even better!
Say no to bots!
I understand the importance of accurate data, and that’s why you will now find a new setting to stop tracking bot visits. You can enable Do not track bots under Tracker settings in the Counter/Tracker tab. Top 10 includes a comprehensive set of bot user agents via this GitHub repository. This will help you have a clearer view of your genuine user engagement, filter out unwanted traffic and get more accurate stats on your popular posts.
jQuery-free tracking
I’m personally a big fan of jQuery. But, I’m conscious that many web devs are attempting to reduce its dependency on the sites they design.
In version 3.3.0, I have rewritten the tracker script, eliminating the need for jQuery. This change results in a faster and more efficient loading process for your WordPress site.
The admin areas continue to use jQuery and jQuery UI.
Better WP_Query support
If you’re still using the tptn_list
shortcode, you’ll be pleased to know that you can now pass all the major WP_Query parameters. Additionally, I’ve rewritten Top_Ten_Query
to also allow the below WP_Query
array parameters to be passed as comma-separated values. So, you can use these in the shortcode as well as in the block.
$array_keys = array(
'category__in',
'category__not_in',
'category__and',
'post__in',
'post__not_in',
'post_name__in',
'tag__in',
'tag__not_in',
'tag__and',
'tag_slug__in',
'tag_slug__and',
'post_parent__in',
'post_parent__not_in',
'author__in',
'author__not_in',
);
Other enhancements and bug fixes in v3.3.0
get_tptn_post_count_only()
andget_tptn_post_count()
can now take aWP_Post
object. Also the former will only return an integer without any number formatting. This strengthens PHP standards while providing more versatility in how these functions are used- Widget styles are handled properly with the block editor
- Post count should only display once within the content within the main loop
- Fixed data labels in the Dashboard graphs
- Custom Post Type labels should also work properly in the Network view of popular posts when the CPT hasn’t been registered across all sites
Changes in v3.3.1
- Enhancements/Modifications:
- When displaying the post thumbnail, the Media Handler will first use the image’s alt tag set in the Media editor. If alt tag is empty, then it will use the post title as a fallback. Filter
tptn_thumb_use_image_alt
and set it to false to not use the alt tag. Filtertptn_thumb_alt_fallback_post_title
and set it to false to disable the alt tag - Orderby clause modified to ensure compatibility if any other plugin rewrites the WP_Query fields
- Media Handler will check if the meta field contains a valid URL
- When saving settings, the thumbnail width and height is forced if either the width or height of the thumbnail setting is set to 0
- When displaying the post thumbnail, the Media Handler will first use the image’s alt tag set in the Media editor. If alt tag is empty, then it will use the post title as a fallback. Filter
- Bug fixes:
- Function
wp_img_tag_add_loading_attr
is deprecated since version 6.3.0 - Bug in
the_content
filter detection which sometimes caused the counter not to display tptn_thumbnail
settings size disappeared from Settings page if this was deselectedmeta_query
argument was ignored
- Function