Multiple single.php pages

Community Forums Forums General Discussion Multiple single.php pages

This topic is: not resolved

Tagged: 

This topic contains 2 replies, has 2 voices, and was last updated by  Summer 1 year ago.

Viewing 3 posts - 1 through 3 (of 3 total)
  • Author
    Posts
  • #65326

    timbarry
    Participant
    Post count: 6

    Creating a category blog page is very useful, but it means that the same single.php file is used when viewing a single post.

    I would like to have multiple single.php templates available so I can show different sidebars depending on the category blog post being shown.

    I know how to achieve this outside of Genesis, for example:

    <?php
    $post = $wp_query->post;
    
    if (in_category('9'))  {
    include(TEMPLATEPATH . '/single1.php');
    } 
    
    elseif ( in_category('8') ){
    include(TEMPLATEPATH . '/single2.php');
    } 
    
    else {
    include(TEMPLATEPATH . '/single3.php');
    }  
    ?>

    but wanted to ask if there is a built in method for making this work inside Genesis?

    Thanks in advance for any tips with this.

    Tim

    #65432

    timbarry
    Participant
    Post count: 6

    Anyone?

    #65433

    Summer
    Participant
    Post count: 1105

    Actually, you would want to use a category template, not a single template. That way you have one template for each category you want to customize, and it works for Genesis and non-Genesis themes, and you’d have a category-8.php, or category-car-news.php, etc.

    http://codex.wordpress.org/Template_Hierarchy

    But if you want more granularity of control over your sidebars, you might be better off with a plugin that manages which widgets appear on which posts/pages.

    I like Dynamic Widgets, and use it on a number of sites to put different AdSense ads or special category listings only on certain pages.


Viewing 3 posts - 1 through 3 (of 3 total)

You must be logged in to reply to this topic.