If you’ve worked in WordPress for more than an hour, you’ve probably noticed the Hello, Dolly plugin. It’s just a happy little plugin whose only function is to offer you a line from the song in your upper right admin area. Cute.
When I recently started learning more about PHP, I was inspired by Michelle Frechette, who re-engineered the plugin into one that gives affirmations of beauty. She was even encouraged by Matt Mullenwig, the original author of the Hello, Dolly plugin. I thought that was pretty awesome.
So I decided a good place to start in PHP would be to tear down that simple plugin and see how it works for myself. Like mechanical things, I love taking stuff apart to see what’s on the inside. It’s why I love my 1966 VW Beetle. At least the plugin won’t squirt fuel into my eye when I put the fuel pump back on. A story for another time, perhaps.
A good way (maybe the only way) to start when creating a plugin is to think about what you ultimately want it to do. IN this case, I didn’t really need to think too much and I didn’t want to change the basic functionality. I just wanted a different song. So I decided it would have to be one of my favorites, R.E.M.’s It’s the End of the World As We Know It (and I feel Fine).
It wasn’t too hard. I didn’t have to reinvent the wheel and it worked right away. But I loved looking at the code and seeing what it did and how it was written.
I’m not going to offer it up on WordPress, because it’s not actually a departure from Matt’s original. I just did it for fun. I’m sure I’ll do more, and on my list is to write my own original plugin. I just have to figure out what I want it to do.