• Resolved mrleesimpson

    (@mrleesimpson)


    Hello,

    I’m trying to achieve a seperate Single page for 3 categories (Graphic Design, Website Design & Blog), I managed to track down the code I need and arranged the files as required. However for some reason I’m have two problems.

    One: When I use the code bellow in the single.php file to query two Single Pages it messes up the CSS of the single page it leads you to i.e. http://dev.mrleesimpson.co.uk/2008/04/test-post-image/

    <?php
    $post = $wp_query->post;
    if ( in_category('3') ) {
       include(TEMPLATEPATH . '/single_graphic.php');
    } else {
       include(TEMPLATEPATH . '/single_blog.php');
    }
    ?>

    Two: When I try to use the code bellow in the single.php file, to query 3 different Single Pages it won’t work at all.

    <?php
      $post = $wp_query- >post;
    
      if ( in_category('4') ) {
      include(TEMPLATEPATH . '/single_website.php');
    
      } elseif ( in_category('3') ) {
      include(TEMPLATEPATH . '/single_design.php');
    
      } else {
      include(TEMPLATEPATH . '/single_blog.php');
    
      }
    ? >

    So it’ll query 2 but it messes up the page layout and it just won’t query 3 at all.

    Has anyone got any ideas?

Viewing 5 replies - 1 through 5 (of 5 total)
  • single.php displays the single post view.
    page.php displays the Pages.
    see Template_Hierarchy

    Not clear what kind of pages/Pages are you talking about.

    For having diffent single post view by categories, use this plugin:
    http://guff.szub.net/2005/07/21/post-templates-by-category/

    Thread Starter mrleesimpson

    (@mrleesimpson)

    Sorry. I’m talking about single post views.

    So I want the single post view for each category to use a different single page template.

    Website Design = single_website.php
    Graphic Design = single_graphic.php
    Eveything Else = single_blog.php

    I really hope someone can help me out with this.

    Thread Starter mrleesimpson

    (@mrleesimpson)

    Right.

    I’ve managed to the get the actual query to work (http://dev.mrleesimpson.co.uk/2008/04/test-graphic-post). But I’m still have the problem with the design.

    The footer and sidebar seem to right out.

    Anyone?

    Thread Starter mrleesimpson

    (@mrleesimpson)

    HAHA!

    Fixed the problem less than 5 minutes later

    Thanks to anyone who took a look at this.

    hello, can you paste the code here becouse i have the same problem

    <?php
    $post = $wp_query->post;
    if ( in_category(’27’) ) {
    include(TEMPLATEPATH . ‘/single3.php’);
    }
    if ( in_category(’21’) ) {
    include(TEMPLATEPATH . ‘/single2.php’);
    } else {
    include(TEMPLATEPATH . ‘/single1.php’);
    }
    ?>

    or i tryed like this

    <?php
    $post = $wp_query->post;
    if ( in_category(‘21,27’) ) {
    include(TEMPLATEPATH . ‘/single2.php’);
    } else {
    include(TEMPLATEPATH . ‘/single1.php’);
    }
    ?>

    but doesnt work

    help please

Viewing 5 replies - 1 through 5 (of 5 total)
  • The topic ‘Querying Single.php Pages? Query/Design Problems.’ is closed to new replies.