WordPress Theme Frameworks: Who needs ‘em!

The buzz word in WordPress circles these days is “framework”. What the hell does that mean? Isn’t WordPress a framework? The official definition offered in the WordPress Codex is “a theme that is designed to be a flexible foundation that can serve as a parent theme for building child themes.” But this doesn’t quite give us enough information.

Taking only the simple definition under consideration, WordPress users are likely to get the impression that, all things being equal, you should use a framework. After all, who wouldn’t want the added benefit and “flexibility” of being able to have “child” themes. Sounds cool.

But once you unpack a framework theme and start futzing with it, you quickly realize all is not perfect in the land of “frameworks”. So here’s my stab at a more useful definition. A WordPress Theme Framework is a theme that has additional code built into it making selected tasks easier for theme developers to manage. The emphasis on developers is mine and is very important.

Over the last several months I’ve built sites using several different frameworks and found that there is little advantage consistent across all frameworks, though each framework has specific advantages. The only consistency is that to really benefit from frameworks you need to have a deeper understanding of WordPress, its syntax, functions, plugins, etc.

If all you want to do is customize a theme, frameworks are likely to drive you crazy.

In Theory

In theory, frameworks are a very powerful thing. The idea is that you can take certain standard needs of theme developers and abstract them into new functions that allow the theme developer to execute customizations without messing with the theme core. With many theme frameworks, if you know what you’re doing, you can perform most theme modifications by editing only the style.css and the function.php files.

By way of an example, the Thematic Theme Framework has a hook called thematic_above_indexloop();. If I wanted to add a feature ad banner above the index loop of a regular theme, I would have to go into the the index.php, find the loop, and ad the code. But in the framework I simply have to go to the function.php file and add the following:

function feature_ad_banner() {
echo 'my feature ad banner';

This code just tells the theme to pull in my custom function when it triggers this action. This gives me a ton of power as a developer because I can easily build an awesome site without worrying about building the “guts” of the theme. Or, to put it simply, I can focus on the cool stuff while ignoring the mundane details.

It’s all about the HOOKS

The drawback is that each theme framework has its own peculiarities and learning the appropriate hooks and filters can take time. If you’re a developer, this time is justified because it saves time on future projects. But if you just understand the basics of WordPress themes and are simply trying to customize one for your own use …especially if you aren’t all that comfortable with PHP … this extra level of abstraction can be a royal pain in your ass. If you’ve modified a loop before, you’ll find modifying a loop in a framework isn’t nearly as simple as you remembered. You have to create your own function and then track down the right hook to apply it to. A mod that used to take you 15 minutes, now takes you an hour.

Again, there are rewards to learning a framework, but make sure you understand the time investment required and how that squares with the benefits you expect to receive in return.

In short, WordPress Theme Frameworks are great for those serious about development. But hobbyist might want stick with an old fashioned WordPress Themes. In future articles I will look a few different frameworks and when you mind be inclined to use them.

About Mike Van Winkle

Ugh. I hate writing profiles. Just read the blog dude.