WordPress.org

Support

Support » How-To and Troubleshooting » how to display different categories

how to display different categories

  • 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.

Viewing 2 replies - 1 through 2 (of 2 total)
  • 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.

    “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”

Viewing 2 replies - 1 through 2 (of 2 total)
  • The topic ‘how to display different categories’ is closed to new replies.
Skip to toolbar