Forums

How to make different categories shows that the category of different page (4 posts)

  1. spider110
    Member
    Posted 4 years ago #

    How to make different categories shows that the category of different page!
    I want a different category pages show different templates!
    it's not the article pages
    I have used this code in category.php

    <?php
    if (is_category('3')) {
       // looking for category 3 posts
       include(TEMPLATEPATH . '/category-3.php');
    } else {
       // put this on every other category post
       include(TEMPLATEPATH . '/archive.php');
    }
    ?>

    But it can not show that category-3.php, always show archive.php.
    If there is any way, how do I operate
    Ths!

  2. markdw
    Member
    Posted 4 years ago #

    If you have a file called category-3.php file in your themes folder then all when you click on the category with ID 3 it will automatically use that template without the need for the above code. Take a look at this page:

    http://codex.wordpress.org/Template_Hierarchy#Category_page

  3. spider110
    Member
    Posted 4 years ago #

    oh! markdw!
    Ths!
    but when i run it
    it's not show category-3.php
    But is archive.php
    I want to know that what its read order is?
    why will demonstrate archive.php , but will not be category.php
    and,is this needs to delete arvhive.php

    Moreover I want to ask that if uses category-3.php,
    does not need to revise other places?
    is the naming is category-3.php?

  4. spider110
    Member
    Posted 4 years ago #

    NO ,markdw! thanks !
    Just I had discovered the mistake,
    originally was my target classification regards classifies the page, has been good,
    the question had already solved,
    Ths!!!

Topic Closed

This topic has been closed to new replies.

About this Topic