Then Comes Dudley
In the process of building custom WordPress themes for various clients over the past few years, I slowly came to realize just how much boilerplate plumbing I’d been doing from project to project. A theme calls for a big hero image with a catchy headline and an intriguing call to action? Make it so. How about an image carousel with options to adjust the delay between frames? Or maybe an list of frequently asked questions, expandable one-by-one until a potential customer has had every single possible question they could think of clarified and addressed?
One of the key tenets of programming is “don’t repeat yourself”, and about a year ago, it finally dawned on me just how much I was. From project to project, I was writing markup for the same exact modules I’d written before, and hooking it all up to the WordPress backend. At that time, I was determined to approach my projects differently; to start cataloging the instances where I was building something I’d built before, and to actually do something with that information, to make something I could reuse instead of reimplement.
In that time, I began to develop a patterns library of sorts, one that worked with the Advanced Custom Fields plugin for WordPress. I approached each new project I took on with my patterns library in mind, and looked for opportunities to improve upon it. I didn’t just want my modules to be reusable, but I wanted them to be extensible, and I wanted to provide anyone who might use it themselves with the ability to work within that framework; to write their own custom modules that they too could reuse and share.
Inspired after attending the final Lone Star PHP conference in Dallas this past April, I decided to brand my work and release it to the wild: Dudley, named after Dudley Heinsbergen, the character from one of my favorite movies, The Royal Tenenbaums. Dudley is a WordPress plugin for developers that allows them to reuse, modify, or write custom, project-specific web components for any WordPress theme. It’s my first real open-source project, and my hope is that, over time, other developers will give it a try, provide feedback about what works or doesn’t work for them, open issues about bugs they find, and otherwise help me understand if what I’ve been thinking about helps them meet a need for some of their most common theming problems. It’s one of the first things I’ve worked on as a web developer that I truly feel proud of. Dudley isn’t without its shortcomings – I’m definitely aware that it began as a tool meant for me and me alone, and I need to make some updates to it to truly open it up to everyone – but I’m excited about where I’ve managed to bring it so far, and I’m hoping that, over time, it will become a tool that other people can incorporate into their projects, as well.
Today, as part of my Five for the Future Day at WebDevStudios, I spent a few hours writing some custom WP-CLI commands for quickly scaffolding some boilerplate files for Dudley. It undoubtedly will need some improvements, but I’m so incredibly thankful for the opportunity to spend some more time improving something that has truly been a labor of love. I hope, with time, others will give it a try and find something to love about it, too.