WordPress is pretty universally reviled among programmers. It's more or less the Walmart of code. A lot of the core code is very poorly written and in a language no one likes. That's never bothered me. What I don't like is that it encourages mixing presentation code and logic. It also encourages terrible behavior by users[^1] and is at least partly responsible for how damn slow the web has become[^2]. WordPress is also often the best choice for clients. Why is something so awful often the best choice? Because clients have budgets and paying me to set up and lightly customize WordPress is dramatically cheaper than paying me to write you something totally custom (and really awesome) using Django or Rails. Budgets are part of reality and with WordPress -- in spite of all that's wrong with it -- the client's money goes further[^3]. WordPress is also fantastically good at some things. The admin is generally very usable and thoughtfully created; the comment system is hands down the best of the web and it has helped millions, possibly billions of people get their ideas on the web. That does not, however, explain why *I* was able to get past my dislike of WordPress. My dislike of WordPress centers around the way it mixes logic -- PHP code in this case -- and presentation (HTML). It's a terrible way to work and terrible thing to try to maintain. I want all my code in one file, all my HTML in another. The code file uses logic to get the information needed and put it in variables. It then passes those variables to the HTML which displays them and all is well. That's how pretty much every thing designed for the web since about 1999 has worked. Except for WordPress. I've built dozens of WordPress sites over the years and for most of that time I've hated every minute of it, which, trust me, is no way to make a living. All that changed about 4 months ago when I discovered [Timber](https://github.com/jarednova/timber). Timber is a plugin that lets you develop WordPress themes using object-oriented code and the [Twig template engine](http://twig.sensiolabs.org/). Timber takes all that is bad about WordPress's coding style and enables the kind of clean, sane separation of code web developers are used to. It makes WordPress behave a bit more like Rails or Django. More importantly, it lets me build WordPress sites without hating every minute of it. I actually like building WordPress sites using Timber. It's not as much fun as using Django, but it's close enough that I ported this site over to WordPress (from a custom Python-based static publishing system). A couple things to note if this sounds good to you. First, yes, Timber is a WordPress plugin. No, from my testing, it won't slow your site down. But yes, it does introduce a dependency on which all your code will hang. Porting from Timber to non-Timber will be non-trivial. Make sure you're okay with that before you dive in. To give you some sense of what it's like to work with Twig, here's what your template code looks like: ~~~.language-markup {% extends "base.twig" %} {% block content %}

{{post.title}}

image alt text
{{post.content}}
{% endblock %} ~~~ Yes, that looks a lot like Django template code. The Twig templating system is based on Django's (so is nearly every other templating project I've come across lately. Django is not perfect, but its template system is clearly pretty close). You still create .php files with Timber, they're just all logic. You instantiate Timber objects and then query for whatever posts/pages/custom post type data you want. Then you pass that on to the template file. Again, that will probably sound familiar to most non-WordPress developers. Who cares? Well, if you hate WordPress because of the way it forces you to mix logic and presentation code then Timber might make your life a bit brighter. If you're perfectly happy with WordPress as is, then why the hell are you still reading this? [^1]: For a long time the WordPress Codex actually said that your wp-content folder was "intended by Developers to be completely writable by all (owner/user, group, and public)." Yup, seriously. It's since been changed, so congrats to the WordPress team on cracking open [Internet Security for Dummies](http://www.amazon.com/Norton-Internet-Security-Dummies-Computers/dp/0764575775), but here's the [Internet Archive page](https://web.archive.org/web/20110325073349/http://codex.wordpress.org/Hardening_WordPress) of that advice in case you don't believe me. [^2]: WordPress supposedly powers about a 1/3 of the web so that alone makes it responsible. But search the web for almost any problem with WordPress and the first bit of advice you'll get is "just install ______ plugin". That's great on one hand, because you don't need to know any code, but because of how WordPress bootstraps plugins it also tends to slow sites to a crawl (and load dozens of external scripts in many cases). [^3]: WordPress is also more widely used and therefore there are more people capable of maintaining it. That means clients have a more future-proof solution than a customized system written in Python or Ruby.