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 read http://codex.wordpress.org/Category_Templates, which tells you how to change your index.php for each category. But I want to load a whole different theme directory in for my site when a particular category is viewed.

So for example, if I go to: http://www.mysite.com/mycategory/ It will load a separate theme.

Is this possible?

share|improve this question
add comment

migrated from stackoverflow.com Apr 9 '11 at 5:40

This question came from our site for professional and enthusiast programmers.

4 Answers

You have two solution I guess:

  1. If you want to work in one Database, here your can just choose one theme directory, and then change the WordPress template hierarchy, because your site when it's loaded connect directly to index of your theme first and then to another PHP file in the theme folder.
  2. You can add others sub-domains to your site, and linked them to official site. and for every sub-domains you can choose one theme. But really it's not recommended.
share|improve this answer
add comment

There is no point in switching to another theme when the category page is loaded because it is actually just the another page of your site which could be customized through the theme category template. I suppose you can use conditional tags for categories to customize your header and footer too or load custom CSS style sheet. Something like:

<?php if ( is_category('your-category') ) { ?>
    <link rel="stylesheet" type="text/css" media="all" href="<?php bloginfo( 'stylesheet_directory' ); ?>/my-category-style.css" />
<?php } else { ?>
    <link rel="stylesheet" type="text/css" media="all" href="<?php bloginfo( 'stylesheet_url' ); ?>" />
<?php } ?>
share|improve this answer
add comment

I think what would work best for your case is making use of the WordPress template hierarchy.

You can actually just create a custom template file in your theme folder named category-{slug}.php to get a custom look for that category.

Example:

If your category was 'Dogs' and the slug you set for it was 'dog', the template file loaded for that category would be named category-dog.php, otherwise it falls back to category.php.

Codex Link:

http://codex.wordpress.org/Template_Hierarchy

share|improve this answer
    
you can also name category-{cat-ID}.php the template for one single category, or add conditional includes of sub-php pages into the original category.php, as written above. –  petermolnar Apr 11 '11 at 6:12
add comment

Your Answer

 
discard

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