5ThirtyOne

Derek Punsalan

Media Temple

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.

Backblaze unlimited secure online backups Find out what Backblaze can do for your online backups

10 Comments • RSS

  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 [...]

Leave a Reply

Comments may be held for moderation. If your comment does not appear immediately, do not repost. I reserve the right to remove any inappropriate or off-topic comments. If you plan on sharing helpful code, please pass it through Postable first. Want other to know who you are? Register a Gravatar.

Syndicate

Subscribe via RSS or Email

Advertisements

9rules network

5THIRTYONE

Public projects

Select project

Something new

Fresh content

Show Latest

Google, the noun that became a verbGoogle. Openly embracing and sharing your info with the online giant... Or trying your best to keep your data hidden from Vader? After you watch the clip, check out this infographic of ... Link