code diy WordPress

new plugin – stats for plugin developers

dnxwporg banner
danixland wporg stats plugin

I’m back at writing plugins, this time I wanted a simple way of displaying all the plugins I developed on my website, so I decided to dive in the API documentation to understand how could I do to get a list of all the plugins I have, hosted on the Plugins directory for WordPress.

widget admin view
admin view of the widget

After reading a little bit about the possible calls to the API I decided to take the “shortcode” road, I wrote a shortcode function that was returning a list of links, but one thing I noticed was that it wasn’t suitable for the use I wanted to make of the list, because I wanted to display it inside the footer of every page on the site. So I went back and took the “widget” way.

After installing the plugin a new widget becomes available where a user can select the plugin author that he wants the data to be fetched for, and the widget will be populated with a list of all the plugins authored by that nickname. Here on the right is a picture of the admin side of the widget with all the current options on display.

Of course you can give it a custom title, you can select the plugins author using the nickname from, so if I wanted to display all the plugins by the same author that wrote the Jetpack plugin I’d write “Automattic” in the author field.

There’s also an option to chose whether to display or not a short description for the widget, it can be standard and include some stats like the total number of downloads and the average rating of all plugins, or it can be customized but (as of version 0.1) without the possibility to include any statistics.

The last two options allow the user to choose how he wants to display the links in the list, he can choose whether he wants to link the plugin page or the custom link provided inside¬†every plugin and if the plugin uses the standard assets directory to store the icons and banners, it’s possible to include an icon for every plugin in the list.

Together with the widget, this plugin ships with a few shortcodes that allow the user to display the stats inside blog posts or pages and even inside custom post types.

[shortcodes list /]

These are all the shortcodes included with the plugin:

  • dnxwporg_stats
  • dnxwporg_single_stat
  • plugin_icon

[ dnxwporg_stats ]
This simple shortcode will show the same stats as the widget but will allow the user to include all the data inside the content of pages and posts.

[ dnxwporg_single_stat total_dl || avg_dloads || pl_count ]
With this shortcode you can display a single stat between total downloads, average number of downloads or authored plugins count. These options are mutually exclusive and you can activate them passing the “true” argument.

[ plugin_icon plugin_name ]
This shortcode will display the plugin icon link for the plugin passed as argument to the shortcode. It will return only the image link, so you’ll have to include it inside an img tag for it to be displayed properly.

How does it looks

this is where things become interesting, by default danixland-wporg-stats doesn’t ship with a stylesheet attached to it, I wanted to make it as customizable as possible, all the output is wrapped inside classes in order for a theme author to apply whatever kind of styling he needs without having to overwrite any preset.

In the gallery below you can see the same plugin working with two different themes, one on my website with all the styling applied to it and the other using the standard twentyseventeen theme without any styling applied.

Following here is the list of all the classes used in the widget as of version 0.1 in the same order as they appear on the display side:


I tried to make it as easy as possible to customize the look and feel of the plugin to make it suit every possible theme.

What’s coming next?

I expect bugs and feature requests to rise as soon as authors will start to use my plugin, so I’ll do my best to fix them and add more functionalities, on top of my todo list is including support for the theme directory so that people can start to showcase their themes as well.

Of course if you use your plugin and have questions or ideas and want to share them with me feel free to comment on this article or write on the support forum on Now go download the plugin from or from the dashboard for your WordPress site.

Danilo M.

By Danilo M.

Hi, I'm Danilo, I own this website.
I love Linux, I prefer Slackware over every other distribution, I live, eat, breath WordPress. I'm interested in technology in general and I try to write on this blog whenever I find the time..

Enjoy your stay on

Leave a Reply

Your email address will not be published. Required fields are marked *

This site uses Akismet to reduce spam. Learn how your comment data is processed.