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.

9 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. 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. Nice :)
    I love working with creating themes for Wordpress.

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

  6. 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. 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. Mmm… Good post :) Will watch your blog

Leave a comment

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.

Connect

Syndicate

Subscribe via RSS or Email

Advertisement

Skribit Suggest (info)

9rules network

Categories