Support » Themes and Templates » Changing header by category

Changing header by category

  • Hi – I’ve been reading through a number of threads to try to figure out how to change the header (which in my case is a series of images stitched together into template in an old version of Dreamweaver) for one particular category (3, as it happens). I’ve created a new “header-3.php” file which has the desired DW teamplate/images, and created a “category-3.php” file by copying and modifying the index.php file.

    Am I on the right track?

    I’m not sure where I should be making the changes to get header-3 when category-3 is selected… any help would be great.

    Thanks – Greg

Viewing 5 replies - 1 through 5 (of 5 total)
  • One option — check out Template_Hierarchy. Scroll down and see the category section? You could create a category-3.php file in your theme that would get automagically picked up when that category is selected.

    Actually, in looking more, this link is probably more useful to you Category_Templates

    Hi – thanks for the link. Have read the Category Templates page but am still at a loss for how I get the page to load the right header. Suspect it might be some sort of “if / else” command? Basically what I want the site to do is use a different header when category 3 is picked – so where do I code an instruction to use header-3.php is category-3 is selected? Perhaps this is not the best way to do it?

    Ok. Maybe this is more useful than the custom category approach. http://codex.wordpress.org/Conditional_Tags#A_Category_Page

    There is also a detailed description (and code!) in this thread:
    (see also the links from there…)

    Thank you both for the suggestions. Have been trying to work with these threads but, as a newcomer to php, with no success. I suspect my problem is pretty basic. Do I put some sort of code in the index.php page (where it calls for the header)? I tried this last night (i.e. some sort of “if cat=3, use header3.php” type of idea) but no luck – could have been bad code, or could have been a fruitless strategy to begin with.

    I see the “is_category(‘6’)” guideline from the conditional tags but not sure:
    1) where this goes? in index.php?
    2) what follows to instruct it to get header6.php

    Some of the other threads seem to end up dealing with new css for a particular category but that’s not what I’m trying to do (unless perhaps that’s the ultimate answer!)


Viewing 5 replies - 1 through 5 (of 5 total)
  • The topic ‘Changing header by category’ is closed to new replies.