WordPress plugins. Incredibly useful to use when you can find the right one. Incredibly annoying to build. Especially when popping your plugin cherry.
So today I want to share my first attempts at making a usable and useful WordPress plugin.
(I’ll include links to my Github - but please note that these plugins are not supported in any way and are not available on the WordPress Plugin repository)
But first…. What are WordPress plugins?
WordPress.org defines a plugin like this:
A WordPress Plugin is a program, or a set of one or more functions, written in the PHP scripting language, that adds a specific set of features or services to the WordPress weblog, which can be seamlessly integrated with the weblog using access points and methods provided by the WordPress Plugin Application Program Interface (API).
But it’s a little more complicated than that and there are some great guides already out there for plugin development:
Time to move on to….
Why write a plugin?
I started working on a blog called Electric Thoughts in a Digital Era and immediately ran into an issue with some specific requirements. For example, a social sharing plugin that included Amazon’s Send to Kindle functionality and a plugin to display selected posts in the sidebar. Question is, which developer rule did I break by deciding to write the second one by myself? Answer right at the end…
Plugin #1: Social Sharing
Plugin #2: Featured / Selected Posts
The brief was to create a plugin that allows a user to select featured posts. Something I’m sure that was done before. Of course being a developer, I decided I could do it better.
At least, not at the time. The plugin saves a comma-separated string of post ID’s via a display list of posts in the admin panel. Pagination isn’t implemented and only the latest 10 posts are shown. But the actual display of those selected posts works just fine.
Both of these plugins are very simplistic and in the second case barely functional. But they do highlight the two ways that can be taken when starting plugin development. Adapting existing plugins or diving straight in without a net. Route one (adapting existing plugins, like Akismet) is the easiest and, in my opinion, the best route to take.
Oh, and the developer rule I broke for the second plugin?
“Don’t Reinvent the Wheel”.