This tutorial is intended to be fully compliant with the official review requirements for themes hosted in the WordPress.org repository, as of (at least) version 3.5. I will make an effort to keep this tutorial up to date, but regardless, it will be operative for many, many versions to come. The official requirements don’t tend to change drastically or frequently; and in any case, by the end of this tutorial, you should have enough knowledge about the WordPress core and theme structure, that you will be able to make any necessary adjustments.
This tutorial includes working code examples for every file and function required to build a working (albeit rather plain) theme. Please, for your own sake, don’t just copy the code without reading the background material or at least understanding and what the code does. Otherwise, you’ll never become a true theme author. Anyone can parrot back a tutorial verbatim without a substantive understanding of what they are doing (take a look through themeforest if you don’t believe me).
If you really, really just want the code for whatever reason, you can download a zip file of the completed tutorial theme. If you’re looking to jump straight to development and don’t care about the learning part, some better options include Automattic’s _s theme (good for those closer to the beginner end of the spectrum) or Justin Tadlocks Hybrid-Core Framework if you pretty much know how to make themes but would prefer a smarter person do all the hard work.
Considerations and Conventions
In the interest of avoiding clashes: any variable, function, or other PHP element that is in the global namespace (i.e. not inside a private function you wrote) needs to be prefixed with a unique slug. For the purposes of this tutorial, I will use the prefix
shinra_ where applicable. If you are planning on distributing your theme at all, you should change any instance of
shinra_ to a string unique to your theme. If you just want to learn the rope, you can leave it as it is.
I’ve tried to adhere to a uniformly semantic markup in this post, especially with the judicious use of
<h#> tags as well as
<code> and <var>. Notes or warnings will have red title text. The links to skip over the more elementary parts of the tutorial with be purple. My heart will remain black.