Multiple themes: How to divert single.php to different category themes? (7 posts)

  1. websta
    Posted 8 years ago #

    Background: I am re-designing the default theme (Kubrick) in WP 2.2 as a CMS. It has 9 primary categories and over 200 (sub-)categories.

    To aid in navigation, each primary category has its own, color-coordinated, header.php and sidebar.php. Consequently, I have 9 header.php files and 9 sidebar.php files. Site thus far is available at: http://www.growandknow.com . The bulk of the content will be Posts, due to the need of the categories.

    Question: I would like single.php to include the sidebar and for single.php to display the appropriate header and sidebar from one of the nine primary categories.

    How is that done?

    It wasn't too difficult to figure out how to divert users to 1-of-the-9 category.php files, but I have no clue on where/how the single.php files are called for, and how to tie the various category themes to single.php.

  2. moshu
    Posted 8 years ago #

    With a little search you could have found this - it has been suggested as a solution 2 days ago (again):

  3. websta
    Posted 8 years ago #

    Moshu, Thanks for the response. I have implemented that plugin already to create the various sub-themes of my site, and tie them to the various major categories.

    However, even with the plugin, I still only get a default "single post" page -- not one of the several themes. Since the entire site would likely be viewed via single post pages, this would likely be confusing for users.

    I assume that I need to make 9 variations of single.php to accommodate this...? Where is single.php is called for? How do I get WP to make that call for a single-post-page divert to the different themes?

  4. Omarvelous
    Posted 8 years ago #

    One possibility....

    Plug the category in the body html element as a class....

    Then through css, make the changes accordingliy when body contains category1 class...

    That's a thought...

  5. websta
    Posted 8 years ago #

    Thanks, Omarvelous. I guess I would need a more detailed info. I am concerned about messing up the "post templates by category" plugin. I have read the following documentation, but I still can't figure it out, so maybe I'm just ignorant/retarded:

    Template Hierarchy

    Template Tags & query posts

    Query based on Custom Field and Category

    Display by Category home.php template

    Category Templates: Introduction

    Displaying Posts Using a Custom Select Query

    Stepping into Templates

    The Loop

    Theme Development

    Query string

    Query Overview

  6. sito
    Posted 8 years ago #


    Even though this is 6 months (too) late, I hope it can still be useful. I just found this myself.


    Look under "unique single template". I think you won't even need to use the "post templates by category" plugin after that!

  7. buckyboog
    Posted 8 years ago #

    I'm having the same problem, I have different single-14.php, single-15.php, single-16.php, templates with a single.php that directs them appropriately...

    I have a post in categories 14, 15, and 16... I want to show the appropriate template based on what category someone is viewing..

    so website.com/14/the-post
    would pull up a different template than


    This is not the case, website.com/16/the-post and website.com/15/the-post always pull up with first category and template, in this example website.com/14/the-post

Topic Closed

This topic has been closed to new replies.

About this Topic