Take the 2-minute tour ×
WordPress Development Stack Exchange is a question and answer site for WordPress developers and administrators. It's 100% free, no registration required.

I've got a subdirectory in which I'd like to implement a completely different theme for my site (basically, its a sales letter).

Can someone tell me how to do that? Do I need to install a separate copy of wordpress in the subdirectory?

share|improve this question
add comment

2 Answers

up vote 6 down vote accepted

To slightly sidestep your actual question, the template hierarchy allows you to have a custom handler for any post ID, category, taxonomy term, etc. That may be the quickest way to solve your problem: just create a template file that stands on its own and only serves request to one post (or category, or however the sales letter(s) are identified).

You don't have to call get_header(), get_footer() or any of the other template functions, so you're free to have a completely different page structure for a single post on your site.

share|improve this answer
    
"for a single post on your site." Or a single page, or category, etc. Just to clarify :-) –  tnorthcutt Aug 26 '10 at 18:20
    
@Scott B: @Adam Backstrom has your answer... –  MikeSchinkel Aug 26 '10 at 18:22
    
Thanks Adam, I appreciate the help. –  Scott B Sep 4 '10 at 15:37
    
perhaps this is a whole other question, but am I allowed to store the special handler template in a subfolder under my main theme? Or does it have to reside in a specific location only? e.g., I want to neatly store these subtemplates inside my theme's "styles" folder, then each inside its own folder under styles. –  Scott B Sep 10 '10 at 15:17
    
@Scott, get_page_templates() specifically disallows page templates in subdirectories. If you want this functionality, you should look at the logic within the get_page_template() function and make use of the page_template filter called within. –  Annika Backstrom Sep 10 '10 at 16:39
add comment

You could load your stylesheets in (a hook) in your header. Then use wp_enqueue_style to load them on a per-site basis:


1.a) make a custom header file for page-template-file.php and use a custom header with a conditional tag (or just use a custom style sheet with a conditional tag).

then do something like this in your functions.php file:

add_action( 'my_styles_hook', 'wpse944_enqueue_style' );
function wpse944_enqueue_style()
{
    if ( ! is_singular() ) 
        return;

    // We use the current directory name as name for the stylesheet file & handle
    $name = dirname( __FILE__ );
    wp_enqueue_style(
         $name,
        ,get_template_directory_uri()."/$name.css"
        ,false
        ,filemtime( get_template_directory()."/$name.css" )
    );
}

So if you load this from the same subdirectory of your theme, then the you'll register an additional stylesheet named exactly like the current directory (the stylesheet remains in the themes root directory). This way you can easily style each page the way you want. Plus you don't load what you don't need.

share|improve this answer
add comment

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

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