Posted on — Last updated on November 23, 2023
WordPress Popular Posts 4.0 is finally out!
A new version of WordPress Popular Posts has been released (and the new tag version -4.0- isn’t just for looks!)
A little over a year now, I was sitting in front of my laptop feeling almost completely satisfied with the level of maturity and stability that WordPress Popular Posts had reached. Finally some breathing room to think about what to do next.
A few ideas came to mind, and there were also quite a bit of suggestions / requests sitting in the issue tracker for a very long time. Some of them actually made it to 4.0.
WordPress Popular Posts 4.0 is the result of a year of work. A year were I had the chance to take a look back and see what was done, what didn’t work and what did work, and the things that had to be done in order to allow the plugin to grow.
WPP was refactored using the great WordPress Plugin Boilerplate by Devin Vinson as a base. I learned a great deal with it, and while I feel there still room for improvements I’m overall pretty much satisfied with the result.
The plugin is now a helluva lot easier to maintain and offers a lot more flexibility, which hopefully will open the door for new exciting features in the future.
What’s new
The Dashboard
Not all of the code work was enhancements and bug fixing related. WPP’s Dashboard also got an overhaul, being the Stats section the one that received the biggest upgrade.
It now features a nice interactive chart where you can view the most popular entries of your site. The old “Last 24 hours”, “Last 7 days”, “Last 30 days” tabs have been integrated into the chart, making it easy to switch between time ranges in a dynamic way. But that isn’t the only change.
The Stats section now features 4 new tabbed sections right below the chart:
Most Viewed
Check out what were the most viewed posts, pages, etc. within the currently active time range.
Click on 7d (formerly known as “Last 7 days”) and the list will update automatically. Pick another time range and the same will happen.
Most Commented
Features the most commented posts, pages, etc. within the currently active time range.
Like the Most Viewed tab, this one also gets updated automatically every time you change the time range in the chart.
Trending now
This is one of the new additions to the Stats section: features the posts, pages, etc. that have been active within the last hour.
Knowing what caught the attention of your visitors within the past hour might give you an insight on what you should write about next!
Hall of Fame
The All-Time range’s got a shiny new name & location!
It’s still the old All-Time range in every other aspect so you can stay in touch with what has historically been your best content so far.
Custom Time Ranges!
This is, by far, one of the most requested features among WPP users. And make no mistake, I wanted it too! WordPress Popular Posts 4.0 finally made it possible.
Now you can select a custom time range everywhere: in the Stats section (noticed the Custom link in the chart yet? *wink wink*); in the widget; and even both the wpp shortcode and the wpp_get_mostpopular() template tag can now list your most popular posts from the last minute(s) / hour(s) / day(s) (see Settings > WordPress Popular Posts > Parameters to find the parameters you need to use to configure a custom time range).
Enter the WPP_Query Class
Another popular request was to have the plugin return somehow a list of popular post objects so theme & plugin developers could gain full control over the HTML markup.
The WPP_Query class receives an array of parameters nearly identical to those used with the wpp_get_mostpopular() template tag (and you can even instanciate it without any parameters!), and has two important methods: get_posts(), which as you may have guessed returns an array of popular posts objects; and get_query(), which outputs the actual database query used to retrieve the set of popular posts.
You can find more details at the GitHub repo.
And there’s more!
If you take a closer look at the changelog you’ll notice that there are a couple of new, shiny things that you didn’t know you wanted 😉
So, how do you like WordPress Popular Posts 4.0 so far?