The themes are not only the look and feel of a site these days, they are also simple plugins. You use themes to get everything to display where you want, and to break the normal flow of posts provided by the loop. Thanks to the template and conditional tags, there are a lot of things you can achieve, and by adding extra functionality in functions.php, by using action hooks, and by being crafty overall, you can build just about anything.
As I've hinted at in this chapter, cramming functions.php full isn't always such a great idea. A lot of things you do in that file can just as well be done by a plugin, and while that is unnecessary or even redundant at times, sometimes it truly is the best decision. After all, the whole idea with various skinning concepts in publishing systems is to separate as much design from the code as possible. When it comes to WordPress themes, it means that you'll have to break that rule a bit if you want to do crafty things.
A lot of those things can be plugins rather than code in the themes, which would fit better with the whole dividing design and code concept. So it makes sense that the next chapter deals with plugins.
In the end, tightening a WordPress theme is more or less the same as tightening any site. Good and tight code, preferably valid, will load faster than clunky and bloated code, so get it right from the start.
And if you're doing everything right but your WordPress site keeps chugging slowly, then maybe you've outgrown your host. After all, when all the PHP calls are minimized, the code is tight and valid, and you've got your accelerators and caching, then there's just not much more that you can do other than crank up the voltage to power your beast.
Was this article helpful?