WordPress.org

Ready to get started?Download WordPress

Forums

how to display different categories (3 posts)

  1. siam
    Member
    Posted 8 years ago #

    Hi there
    I´ve been looking for help in the docs but still I can´t manage this. I´m trying to display different templates (just the header would be diferent, really) in diferent categories. I´m suposed to change category.php but I don'ta have that archive. Im using Mapleleaf Theme. I just would like to know WHERE do I have to write the code for this. I guess it´s index.php? Should I copy it and rename it to category-2.php and change the header in there? Any hint would help,as you see I´m completely lost. I know some PHP and HTML and CSS but seems not enough.
    Thanks a lot for your help.

  2. Chris_K
    Member
    Posted 8 years ago #

    I bet this codex page will help you: Category_Templates

    And yes, you'll want to create some category-x pages in your theme directory.

  3. Dgold
    Member
    Posted 8 years ago #

    "index.php? Should I copy it and rename it to category-2.php and change the header in there?"

    Yes, that sounds like you're on the right track. Create category-2.php (and category-3, if it's gonna look different, if all cats look the same then just make category.php). Create it or copy another file. Check out the "Template Hierarchy" page in the Codex to see which template will be used by-default in order.

    However, another method might be using "Conditional Tags" that would say, in your header.php I think.... basically, "IF this is category 2 then display image 2, IF this is cat 3 then display image 3"

Topic Closed

This topic has been closed to new replies.

About this Topic

Tags