1. This site uses cookies. By continuing to use this site, you are agreeing to our use of cookies. Learn More.

[QUESTION]Templates for categories - How to?

Discussion in 'Blogging' started by cyklotrial, Aug 23, 2010.

  1. cyklotrial

    cyklotrial Regular Member

    Joined:
    Oct 13, 2008
    Messages:
    248
    Likes Received:
    82
    Location:
    Wonderland
    Hello!

    I have a small problem with wordpress.
    I would like to use WP Categories as a subdomains.
    Each "subdomain"(category) should have diffrient theme.(Is there any plugin that will let me setup diffrient theme for each category?) How to do this without having separate WP installations on each subdomain? - I want to have acces to all of them via one "control panel".

    thanks
     
    Last edited: Aug 23, 2010
  2. madoctopus

    madoctopus Supreme Member

    Joined:
    Apr 4, 2010
    Messages:
    1,249
    Likes Received:
    3,498
    Occupation:
    Full time IM
    I think setting up htaccess rules in each subdomain root might work. You basically make a rewrite rule so that a call to subdomain.domain.com triggers domain.com/category/subdomain. You will have to manually create the subdomains though or code a plugin to get them done automatically when you create a new category.

    http://httpd.apache.org/docs/1.3/misc/rewriteguide.html
    The "Virtual User Hosts" is close to what you need (but needs adapting).
     
    Last edited: Aug 23, 2010
  3. cyklotrial

    cyklotrial Regular Member

    Joined:
    Oct 13, 2008
    Messages:
    248
    Likes Received:
    82
    Location:
    Wonderland
    I know how to setup category as a subdomain :)
    But have no idea how to make that each category will have its own theme.
     
  4. madoctopus

    madoctopus Supreme Member

    Joined:
    Apr 4, 2010
    Messages:
    1,249
    Likes Received:
    3,498
    Occupation:
    Full time IM
    oh, for that you create theme files named category-categoryslug.php or category-ID.php (is is the numeric ID of the category) in your theme's directory. So, for widgets category you make a category-widgets.php file. That basically instructs WP that you want that specific page to be used when rendering listings of that category. To also cover the posts within that category you have to add some code in the post.php template file so for example it does an include or require on a different category-specific template file of post.php. All I can tell you is that it can be done, telling you how exactly to do it would take some time for me to test and stuff, time that I don't have.

    This is the WP template hierarchy: http://codex.wordpress.org/images/1/18/Template_Hierarchy.png
    Also look at: http://codex.wordpress.org/Function_Reference/in_category

    good luck!
     
    • Thanks Thanks x 1
  5. cyklotrial

    cyklotrial Regular Member

    Joined:
    Oct 13, 2008
    Messages:
    248
    Likes Received:
    82
    Location:
    Wonderland
    Thanks madoctopus, but it's still not solving my problem.
    Why? Cos i want to use diffrent themes for each category...
    So i want to "movie" to use On Demand theme, "music" Backstage yheme etc etc.
    I think tha the easies way to do this will be creating separate WP blog for each category/subdomain and than use or create Main page+multiblog control panel...

    thanks