Themes & Plugins WordPress

Writing Plugins for WordPress

The WP Logo Comparison
Written by Mika Epstein

I’ve written quite a few plugins for WordPress, ranging from the absolutely silly RickRoll to the insanely complex DreamObjects Backup . I’ve taken over a few abandoned plugins, forked others to do things the original authors never dreamed of, and I’ve written some from scratch.

The ability to take other people’s code, read it, learn from it, and improve on it, is one of the basic tenets of Open Source, and it’s allowed me to become a bit of a developer. I always hesitate at using terms like ‘rockstar’ or ‘ninja’ when it comes to my code, and I grew up in the shadow of a father who invented an entire software app from scratch, seeing a future no one else did. When I compare myself to my father’s code, I’m a hobbyist at best.

However, the manner in which I became a code wrangler and learned how to write extensions for WordPress, MediaWiki, Drupal, and many other software tools, is because those applications give away their code, freely, for anyone to use and study.

Many many times I’ve heard it said ‘If you want to know how to code for XYZ, just read the code.’ Thankfully, more often these days I hear ‘And here’s an example.’ Open Source has moved beyond the original standpoint of ‘it’s here, it’s free, use it’ and is now at a place where we’ve begun to embrace open code sources and open code education. There are wonderful places that will teach you how to theme and how to write code and wonderful people who will answer your questions.

Those people explained to me what the code meant, how it worked, why it worked, and let me play and break things until I understood what was right and what was wrong. They come and tell me when my code is bad or insecure, and they come and help me fix it. Because open source is more than just code, it’s community as well now.

But for a post about code, there sure hasn’t been a lot of code, has there?

The very first plugin I wrote, I actually no longer maintain. It was a plugin called ‘spoiler tags’ and was for bbPress, back when it was a separate application and not a WordPress plugin. The first WordPress plugin I wrote was one I’ve since handed off to another developer to maintain. The last plugin I wrote is a proof-of-concept one called Fauxgo (which replaces the WordPress logo with the fake Fauxgo).

The WP Logo Comparison

That Fauxgo plugin is pretty fun and consists of very little code. First I looked up all instances of the WordPress logo being used and looked at the source code where it was called. From there, I saw that WordPress uses CSS (Custom Style Sheets) and an icon-font called Dashicons in order to display the logo. I found a high quality image of the Fauxgo and used IcoMoon’s tool to convert an SVG to a very small icon font , and used CSS to override all the calls for the logo to call my Fauxgo instead.

You can see the Fauxgo code here: https://github.com/Ipstenu/fauxgo

But none of this would have been possible if the code wasn’t all free and open for me to read and play with. Even though this plugin is a silly concept and really only meant to amuse me and prove a point, it has a practical use for a company that wants to use WordPress internally but change the logo to match their branding. You can totally do it and, since my code is also Open Source, take it and run with it.

Developing plugins and add-ons for Open Source is more than just fun. It lets you extend a tool without weighing it down with more options for users. Simply, the code you don’t need isn’t there. If you do need it, you can just add it. If it doesn’t exist, it can be written, allowing progress to happen at the speed of our imagination.

Take that, Microsoft.

About the author

Mika Epstein

A happy DreamHoster since 2012, Mika is one of the WordPress developers at DreamHost. When she's not making DreamPress better or practicing being the person you want with you for the zombie apocalypse, she's slashing bugs in the next version of WordPress.