I'm just getting my feet wet with templates and have a few questions.

First, Ideally, my templates use the same structure as my main theme, however, they simply use a different stylesheet and images.

Currently, the way I allow changing the look of the site is with stylesheet switching.

I simply have a folder under my main theme called "styles", then under that I have a single folder for each of my "skins". Inside each skin folder is a style.css along with some images.

The way it works is that I've placed some code in my main theme's header.php file, so that it reads the value of the currently active skin from the options database, then loads the stylesheet for that skin like so...

In the above example, the active skin is "skin1" so I'm always loading...

"...mytheme/styles/". get_option('active_skin') ."style.css"

This works exceedingly well, and allows me to place a simple skin switcher widget (a pulldown menu with thumbnail display) inside my function.php file to allow the admin user to easily switch between several skins that completely change the look and feel of the site.

The beauty of this approach is that the selected theme and underlying markup remains unchanged, so I'm able to create a variety of styles using predictable markup. Sort of like CSS zen garden. Same markup, thousands of designs. All that changes is the stylesheet and images.

However, the one downside to this approach (at least with WordPress) is that the selected skin applied to the whole site. I'm unable to apply one skin to the home page and one skin to a special page that might need a completely different look and feel.

If there was a way to add some code to each skin folder so that it would appear in the "templates" drop down menu in the page editor, I'd be able to do exactly what I want.

Is this possible?

2 Answers 2


Sure it's possible. The quick way would be to add a custom field to the postmeta (in the "Custom Fields" area of the Edit Post/Edit Page page) and in your theme get the value using get_post_meta().

The slightly-less-quick way would be to add a wrapper to this Custom Field value by putting your theme selector in a post meta box.


I was just looking at the page template autodiscovery for another question, and it turns out WordPress explicitly disallows template files in subdirectories. You'll have to go about it another way, such as using custom fields as gabrielk suggested, or doing providing a UI to the same meta fields using custom admin meta boxes.

  • you could still do a template redirect (i guess - never tried).
    – kaiser
    Commented Mar 16, 2011 at 21:12

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.