Forums

About Category judgement on the template (3 posts)

  1. spider110
    Member
    Posted 4 years ago #

    Hello !
    I am trying to get a DIFFERENT Category php template to show when I add this code, BUT for some reason, its not working for me,

    The "else" seems to work , meaning : when I run this code , ALL the other pages show my "Category.php"

    BUT my PROBLEM is the cat "762" ALSO shows the single1.php :(

    Can someone tell me what I am doing wrong PLEASE :) ( with sugar and cherries )

    I am trying to apply the following: ( This is placed in my Category.php )

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

    ANY help all all would be great :)
    Ths!

  2. Chris_K
    Member
    Posted 4 years ago #

    What you're trying to do is already built-in. Read up on Category_Templates in the codex.

    Or am I misunderstanding what you really want? If so, more details please.

  3. spider110
    Member
    Posted 4 years ago #

    I want a different category show different templates
    category_templates inside said, you can use the following code

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

    but for some reason, its not working for me,
    meaning:when I run this code , ALL the other pages show my "Category.php"

    my meaning :How can I use the above code, before we can call a Category-3.php
    Or, have other ways to make different category pages, show different templates

    PS: I speak English to the not so good! ^_^

    Ths!

Topic Closed

This topic has been closed to new replies.

About this Topic