Blog

WordPress

Posted on — Last updated on July 5, 2024

WordPress Popular Posts 7.0: Classic Widget is No More, WebP / AVIF Support!

Other goodies included as well

As of version 7.0 the “classic” WordPress Popular Posts widget will stop working. If you haven’t done so yet then it’s time to migrate to the [wpp] shortcode or the WordPress Popular Posts block.

This release marks the end of the classic widget, first introduced in version 2.3.7 which released a little over 10 years ago (at the time of writing).

WordPress Popular Posts widget in Classic Widgets screen

A great little widget, used & loved by countless users over these long years. It helped place WordPress Popular Posts among the most widely-known popular posts plugins for WordPress.

And, as with everything else in life, its time has come. The classic widget was officially deprecated last year and is now superseded by the WordPress Popular Posts block, the next generation for your popular posts list with the same features and functionality as its predecessor.

If you’re still using the classic WordPress Popular Posts widget on your site please follow the Migration Guide to learn how to transition from the classic widget into the [wpp] shortcode or the WordPress Popular Posts block.

Native WebP / AVIF Support

WebP and AVIF are two modern image formats that deliver exceptional image quality at a fraction of the file size of more well-known, traditional image formats such as JPG and PNG. WebP and AVIF are nowadays widely adopted by most / all modern web browsers so they’re safe to use (see webp usage and avif usage.)

Version 7.0 adds the ability to format your popular posts thumbnails as either .webp or .avif. You’ll find a new “Thumbnail Format” option under Settings > WordPress Popular Posts > Tools > Thumbnails that will allow you to pick whichever format you prefer.

Thumbnail Format Dropdown

By default the plugin will continue to serve thumbnails in their original format(s). To use either .webp or .avif please head to Settings > WordPress Popular Posts > Tools > Thumbnails, select your preferred format and click on Apply to save changes.

Please note that to access this new Thumbnail Format option:

  1. Your site must be using at least WordPress 5.8 in order to be able to create .webp images
  2. Your site must be using at least WordPress 6.5 in order to be able to create .avif images
  3. Your web server’s image library (Imagick and/or GD) supports at least one of these formats

New wpp_custom_header_html filter hook

@abid76 was gracious enough to propose and even implement a new filter hook to fully customize the HTML markup of the popular posts list headline.

The wpp_custom_header_html filter hook provides two parameters: $header_html, which is the original headline HTML markup; and $options, an array of options coming from the plugin in case you need to dynamically change the headline according to specific option values.

Thanks again @abid76 for helping improve the plugin!

Minor Updates & Hotfixes

7.0.1

Version 7.0.1, released on July 5 2024, fixes a couple of issues and improves compatibility with some site optimization plugins.

Site optimization plugins are a great addition to the WordPress ecosystem since they help automate some time consuming tasks such as bundling and minifying stylesheets and scripts with just a couple of clicks, things that otherwise would have to be done manually. An optimized site will often rank better in search results vs non-optimized ones (due to search engines favoring fast loading sites in general), and visitors also benefit from fast loading sites since, well, no one likes slow sites.

With that being said, minifying scripts may result in JavaScript errors and/or layout issues if not done carefully since scripts may not run when expected (or at all). In WordPress Popular Posts’ case this may prevent the plugin from tracking pageviews, your popular posts list not loading at all, etc.

Starting version 7.0.1, the plugin will automatically exclude its script from the JS minification/packaging process of third-party plugins, specifically LiteSpeed ​​Cache, Autoptimize, W3 Total Cache, and Speed ​​Optimizer. If you’re using any of these plugins please purge its (their) cache after installing or upgrading to 7.0.1. (And even if you’re not using these specific plugins it might be a good idea to clear your site’s page cache anyways.)

Version 7.0.1 also patches up the following problems:

  • The popular posts list may not load on iOS/MacOS browsers (props to Marlys Arnold and abid76!)
  • The wpp_get_views() function may return an unexpected value when using its caching feature (introduced in version 7.0.0) (props to robwkirby!)