I apologize if this questions has already been answered, I have a feeling I'm just not using the right terminology for my search.

I'm in the process of building a base theme for my employer. One of the things we want to do with this new theme is have the option to switch from a standard template to one that's been Zurbified. The way I'd prefer to handle this is by having an admin panel checkbox.

Within the theme itself we want to have 2 separate folders that contain the actual theme template files (Ex: theme_folder/normal/page.php || theme_folder/zurb/page.php).

How would I go about properly processing this? Is there a hook/filter that allows you to specify which sub folder to use in the specific situation? From what I read its possible to have the sub directories house the template page files,
, but I'm not finding the call I need to tell Wordpress to use the specific subs.

2 Answers 2


When I want to change a specific part of template, such as header OR footer then I use conditions like this -

if(is_404()) {
    get_header(`error`);    //loads header-error.php
} else {
    get_header();           //loads header.php

In your case, you want to load a completely different template, Now the only action hook I can imagine is - template_redirect, Which can be used to tell wordpress to load a different template as per conditions.

Example -

function wpse62337_zurbified() {
    if ( CONDITION ) {
        include (TEMPLATEPATH . '/zurb/page.php');
add_action('template_redirect', 'wpse62337_zurbified');
  • From my preliminary tests this appears to be what I was looking for. Thank you!
    – voodooGQ
    Commented Aug 19, 2012 at 19:54

If I understand you correctly, you want to have one theme and just have some conditionals to load different templates based on a checkbox.

The article you linked to deals only with page templates and does not apply to all the other template files within the WordPress ecosystem, for example for posts or categories (though you can also add this functionality to posts with some coding).

If you want to apply a technique that deals with all WordPress templates your probably better off using get_template_part and having the "zurb" version as a sub-folder within the default theme. Then you can use some conditionals to load what you want.

If your only talking about page templates, WordPress auto scans the theme directory including subfolders, so as long as you structure the template header it will find it, this includes child themes.

tl;dr you don't have to do anything besides have the required header

For example

Template Name: Snarfer

Of course if there are a lot of files to scan and subdirs you will take a performace hit.

Also be be advised that:

Renaming a page template — and that includes moving all of top-level page templates into a directory — will unassign that page template for all pages currently using it. This is a new tool in your toolbox, but use it wisely

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.