I have a new plugin.
With this plugin, I’ve experimented with Singletons, more MVC, creating and using custom database tables, widgets, and shortcodes.
The usefulness of the plugin is questionable, but working with this range of features has been extremely helpful in learning more about WordPress development.
The idea behind the plugin is that it tracks visitors to this site – yes, I am watching the two of you who read this blog – and then displays a message, either through a widget or a shortcode, that gives visitors a sense for how many are currently viewing this site.
Yes, it’s a little creepy, I know, but I’m not tracking as much as Google. If you don’t believe me, check out my source code on bitbucket.
To see the plugin in action, take a look at the new widget on this site, currently with the label “CHRISBOT SAYS:”.
If you visit this site from two or more IP addresses, and fake multiple visitors, you’ll see the message in the widget change.
Here’s the output via a shortcode:
There are at least 2 other adventurers in this pristine site. Obviously, it's getting too crowded around here.
I utilized many helpful resources during this project. Here are a few of the ones I found the most useful:
- Man In The Arena’s post on Singletons
- Smashing Magazine’s WordPress Shortcodes: A Complete Guide
- Chris Knowles’ How To Build WordPress Widgets Like a Pro
- WordPress.org’s Creating Tables with Plugins
I think I’ll start experimenting with an administrative interface to this plugin to allow site admins define the messages that are displayed.
Follow me on Twitter: @amelungc