Improve WordPress theme workflow

Anyone who deals with multiple WordPress driven sites in concurrent development can attest to the tedious task of creating the basic folder and file structure requirements. Note that the following tip is not limited to the development of WordPress. The tip can very well be applied to any active developer workflow which requires some type of structured templating system.

base wordpress directory

The basic WordPress directory structure, in its simplest form, resembles the following:

/wp-content/themes/theme folder/
/wp-content/themes/theme folder/images/
/wp-content/themes/theme folder/js/
/wp-content/themes/theme folder/header.php
/wp-content/themes/theme folder/home.php
/wp-content/themes/theme folder/index.php
/wp-content/themes/theme folder/single.php
/wp-content/themes/theme folder/footer.php
... additional templates

Repeatedly recreating the above file structure is not so much as time consuming as it is tedious. Being a creature of habit, my local development folder contains a single generic base directory from which all development begins. Within this base directory, I’ve created the essential templates which I would normally use during development. Each of these templates is stripped to the core allowing complete flexibility on a per project basis while saving time retyping redundant code. Creating WordPress driven sites from this point on are as simple as duplicating and renaming the generic base folder and making the appropriate customizations.

Discuss - 10 Comments

  1. Cool idea.

    I sort of do the same thing with regards to CSS. I have a base style that all my sites link to and then I add specific CSS to each site.

  2. Awesome. I’m just starting on developing some WordPress themes and was planning on doing some consolidation with these files. If you don’t mind, could you share how you consolidated the files?

  3. Derek says:

    There is no consolidation of files going on. The tip is that developers who utilize the same file structure time and again should consider creating a simple, yet effective means in which to cut down on the time required to manually recreate individual files. Everyone has their own methods to work with…

  4. Vimal says:

    Nice 🙂
    I love working with creating themes for WordPress.

  5. Ben says:

    Been meaning to do this forever, your post finally prompted me to get off my ass 🙂 You’re a life saver.

  6. Alistair says:

    Using MAC OS X, you can use Automator to increase the powerof this by having it rename your main folder, move the files to your Sites folder, and add in any other tools with some interactive Q & A. This way, you simply invoke the “New WordPress” automation and it walks you through the rest.

  7. Derek says:

    That’s a great tip Alistair. A great idea for OS X Tiger+ users who have grown accustomed to utilizing the Automator for tasks.

  8. sequiened says:

    Mmm… Good post 🙂 Will watch your blog

  9. […] Continually completing projects which deal with templates? Save time by creating a master template from which to build off-of. This is something that I work with when creating WordPress based sites. TextMate users may want to check out the WordPress Theme Bundle. […]

  10. […] devoid of styling, but with a semantically rich set of classes applied to the markup. (Technically, even this is a framework.) Regardless of what’s included or discarded, one certainty is that each framework will have […]