WordPress Themes and Web Development

Published on July 31, 2016 (↻ September 20, 2023), filed under (RSS feed for all categories).

Like everyone on this planet I work with WordPress. Just setting up a new project I ended up using and building on one of their default themes, Twenty Sixteen. Had I better not?

In this brief episode about terminal code disease and maintenance trauma, the first thing I noticed were an exuberant number of line-height definitions—77 when I searched, down from 165 in the Twenty Fifteen theme. The first thing I thought, then, was that there was not a single web project on this planet (that isn’t typography-related) that needed as many definitions for their leading—and that the WordPress theme style sheets felt just a little too WET, unnecessarily driving WordPress users to despair and complain (it happens).

But that was leading; working and poking further revealed many grave maintenance problems—Twenty Sixteen was not just WET (as the Atlantic, as I happily wrote in the first draft of this), but also presentational (from .widecolumn to .alignleft), verbose (leading zeros and such), and inconsistent (underscore as well as dash separators). The whole adventure spanned more than 6,000 lines, too, for a default style sheet and basic theme (cf. about 2,000 lines for Google’s entire reformatted Maia framework, or 1,000 lines for this site). Not intending a plug for a book, neither the usual pointer to maintainability guidelines, but noting that that was, sadly, lacking.

At this point I was torn between speculating—yet it should rather be the WordPress team to analyze what led to the different issues—and cheekily betting that anyone maintaining Twenty Sixteen was over-cautious and loathing, perhaps, to touch it. That suspicion got fed after having a closer look at another bad habit among web developers, the old reset fallacy—in its most beautiful form, namely the one that, on removal, demonstrates not only how inefficient but unnecessary resets (and “normalizers”) are:

Twenty Sixteen theme default.

Figure: Twenty Sixteen reset.

Twenty Sixteen theme, without reset styles applied.

Figure: Twenty Sixteen not reset (spot the differences).

And yet! There still are much worse style sheets than this. There are a few really good things to note in Twenty Sixteen, from structure to comments, and there’s a good chance of the theme developers simply paying tribute to complexity (when I said “basic theme” then in the awareness that for such a versatile tool as WordPress, there’s no such thing as basic).

Am I contradicting myself? WordPress CSS is bad, WordPress CSS is good? No. The particular problem here is that WordPress is so incredibly popular—an amazing success story—that code suffering from problems like the ones described, spread through thousands or more of installations, is troubling as are epidemics in physical life.

When we share code, and be it for skins and themes, we have a special responsibility: Such code, more than any other code we write, needs to be excellent. The least we want are problems like the ones mentioned to explode by overwhelming our less experienced peers and encouraging them to, for example, write little maintainable, “fire and forget” style code as well, or petition W3C folk to “do something.” So as always, you can tell, we have a rant with a positive twist, and I hope WordPress has some leads, at least votes for their bug requests, to investigate so to tailor and further increase the code quality of their themes.

I decided to use a general title for this post because of similar issues in other WordPress themes I looked at, standard themes and not. The title is still a hasty generalization, which means there may be other themes that are exactly as excellent as so requested.

Was this useful or interesting? Share (toot) this post, or maybe treat me to a coffee. Thanks!

About Me

Jens Oliver Meiert, on September 30, 2021.

I’m Jens (long: Jens Oliver Meiert), and I’m a frontend engineering leader and tech author/publisher. I’ve worked as a technical lead for companies like Google and as an engineering manager for companies like Miro, I’m close to W3C and WHATWG, and I write and review books for O’Reilly and Frontend Dogma.

I love trying things, not only in web development (and engineering management), but also in other areas like philosophy. Here on meiert.com I share some of my views and experiences.

If you want to do me a favor, interpret charitably (I speak three languages, and they can collide), yet be critical and give feedback for me to learn and improve. Thank you!