Over the weekend, I gave a presentation on developing WordPress themes for fun and profit. It went really well and I thought it would be a good idea to go into a bit more detail on everything I mentioned so that people can have a point of reference. I began my presentation with the new guidelines that are still being set up on WordPress.org and that is what the first part of this series will focus on.
WordPress 3.0 Changes Everything
With the release of WP 3.0, the “official” theme reviewer(s) on WordPress.org thought it would be a good idea to improve the current requirements and come up with a strict guideline to let theme developers know exactly what is expected of their themes. This would make the job of reviewing themes for WordPress.org much easier, but it would also set a standard for all the themes within the WP Themes Directory, and hopefully, all WP themes in general.
As a developer, the more documentation you can get about the software you are developing for, the easier your job is. And now WordPress has three pages in the codex dedicated to theme development that all developers need to read and understand.
The Theme Unit Test
The theme unit test is an xml file that a developer should use in their testing environment. If you do not have a test install of WordPress to test your themes, that is the first step you should take. Once you have you test install up and running, download the theme unit test xml file and upload it into your WP install by going to the Tools panel in your wp-admin and clicking on the Import link. Import the xml file and all of the images associated with it. Now you have a test blog full of content that will help you make sure that your theme works with the many different features of WordPress.
The codex page lists all the different types of content that is uploaded by the xml file, and how is should be displayed by your theme. If things don’t look right on your theme, then you need to make sure to follow the guidelines and include the proper functions and/or CSS to get it looking the way it should.
Codex page: http://codex.wordpress.org/Theme_Unit_Test
Theme Development Guidelines
The title of this codex page pretty much says it all. These are the guidelines for developing a WordPress theme. There are many things that need to be in place in order for your theme to work with WP. If your theme does not conform to these requirements, it will not work with WordPress. That’s why this part of the codex is the most important piece of documentation for any theme developer.
Reading through the guidelines will put you on the right track in regards to how your theme should be structured, what functions are a must, and what files need to be included in order for it to work properly. The page is quite long, but once you get trough it and start to piece together your theme, you’ll realize that it isn’t as hard as it seems. And remember, all well-built WordPress themes follow these guidelines, so just take a look behind the scenes of one of your favorite themes to see how the code has been implemented if you feel you’re stuck.
Codex page: http://codex.wordpress.org/Theme_Development
Theme Review Process
This page describes exactly how your theme will be scrutinized if you submit it to the WordPress.org Theme Directory. Knowing exactly what the theme reviewers look at and using that information to personally judge your own theme will help guarantee that you have developed a theme that is up to snuff. It also lets you know some of the dos and don’ts that you should be aware of that were not discussed on the other two codex pages.
Codex page: http://codex.wordpress.org/Theme_Review
Part 2: What goes where?
Next I will discuss what basic templates files are necessary for your theme and what code is required in order to get everything working properly.