All sites should be as fast-loading as possible, and that applies to WordPress-powered sites as well. You can do quite a lot on the theme side of things, but the question is how much you really want to do. If you take it to the extremes, you’ll end up with one-line files that will be completely impossible to edit, which means you’ll need a non-optimized workfile that you later optimize. This usually applies to stylesheets, which can be smashed together quite a lot, and hence you’ll save a few bytes, but it also means that you won’t be able to scan them easily when looking for something. So with that in mind, what can you do to speed up your theme?
Clean out unnecessary code. Most themes would do well with a going-over or two after they appear to be finished.Minimize PHP usage. Direct links to images in your theme directory, usually called with bloginfo('template_directory'), will save you several PHP calls. There are a lot of those in most themes, as there is automatic output of the site’s name and things like that. If you expect large amounts of traffic, hardcode that into the theme instead.
Beware of plugin overload. Plugins are great, but sometimes they aren’t all that well designed. At the very least, they represent one or several more PHP queries and possibly database processing. You should consider each and every one of them carefully.
Outside services. This is not strictly in your theme, but outside services such as chat widgets or Twitter badges take time to load and will impact the performance of the site in the eyes of your visitors.
Accelerate and cache PHP. Your hosting solution of choice may offer PHP accelerators and caching for often-called functionality. Talk to your hosting provider for options, and then make sure that they are compatible with WordPress; all may not be.
WordPress caching. There are caching plugins for WordPress that store static files rather than serving data from the database all the time. This can actually speed up a site, so it may be worth considering.Tighten the files. You can Google your way to both HTML and CSS compressors, which tighten your files but make them a whole lot harder to read. Be sure to check the output to ensure that the compressors’ scripts haven’t added something malicious. You can never be too sure.
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.
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 article, 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.
Our website is not responsible for the information contained by this article. Articleinput.com is a free articles resource thus practically any visitor can submit an article. However if you notice any copyrighted material, please contact us and we will remove the article(s) in discussion right away.
Note: This article was sent to us by: Eliott Anister at 05212010
1. How to do lifestreaming with WordPress
All articles are property of their respective authors. Please read our Privacy Policy!
© 2009 ArticleInput.com.
Partners: Damenmode