Ben is a lifelong Nintendo fan who likes to build websites, and make video games. He buys way too much Lego.
Recently I was contacted on Twitter by Josh Fialkoff how I develop WordPress themes, and I thought the answer would make for perfect blog fodder.
I used to work entirely on my local computer, with apache, mysql, and php installed (XAMPP on Windows, MAMP on Mac), however working like that made collaboration really tough so I decided to move online, and that’s what I am going to write about below.
WordPress Development Site
My solution was to create a sub-domain on one of my websites and then install WordPress mu (which is now WordPress 3.0). Using the multi site feature of WordPress means that I can have a separate site for each theme without having to set up loads of copies of WordPress.
As I mentioned I moved my development online, but the coding is all done with software on my local machine. I use different software depending upon the job or the operating system.
On Windows I use the killer combination of Notepad++ and WinSCP. WinSCP is an awesome piece of freeware that works as a remote file browser/ ftp program. Notepad++ is also fantastic, and unfortunately I haven’t been able to find anything that replicates their functionality on my new MacBook Pro.
On the Mac I have two different setups depending upon the task. My WinSCP replacement is Transmit 4, and Notepad++ has been replaced by Editra (nope, not TextWrangler/ BBEdit or any of the other more famous editors). My second choice is a standalone program, Netbeans. This is a fantastic bit of kit but is best suited to projects (perfect for themes) and not individual files (such as I edit with Transmit and Editra).
To test my themes I install some test WordPress content and a couple of plugins.
The test content is used to make sure that the css and the functionality cover all the possibilities. All css styles, and all possible combinations of built in functionality. Eg comments on/ off, threaded comments, trackbacks, sticky posts etc. To do this yourself I would recommend the official WordPress test content.
In addition to the test code I install a database query plugin. This plugin allows you to check what queries are executed on the site and then optimize your code to either reduce/ remove queries, or to see what ones are running slowly and need rethinking. Provided you are using the built in WordPress functions and not writing your own queries you should be fine, but start writing complex queries and there may be problems.
One thing I am missing is a decent automated test suite for WordPress. I’ve seen a few attempts but so far have yet to find something that does everything I want in as little effort/ input as possible. The easier it is to run the tests the more tests will be executed. I think that’s a challenge for someone more intelligent than I to solve.
Because I develop online theme deployment is much easier. What I did was write a small bash script that copies the theme files to my demo server (which is actually a sub-domain running from the same machine). My bash script also deletes all cache file, and packages up the theme zip files so that people can download the themes as soon as an update is published.
SVN/ Version Control?
One thing I haven’t mentioned is SVN or Version Control, this is something I haven’t really used for my personal work (have used it in the day job though), and it’s something I am definitely considering moving over to but for the time being it’s not really required.
So how do you develop your webites? Is there anything I could do better/ differently?