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?
WordPress Development Stack Exchange is a question and answer site for WordPress developers and administrators. It only takes a minute to sign up.
Sign up to join this communityI'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?
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.
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
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.