WordPress.org

Ready to get started?Download WordPress

Forums

Changing header by category (6 posts)

  1. greg54
    Member
    Posted 8 years ago #

    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

  2. Chris_K
    Member
    Posted 8 years ago #

    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

  3. greg54
    Member
    Posted 8 years ago #

    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?

  4. Chris_K
    Member
    Posted 8 years ago #

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

  5. moshu
    Member
    Posted 8 years ago #

    There is also a detailed description (and code!) in this thread:
    http://wordpress.org/support/topic/30653?replies=16
    (see also the links from there...)

  6. greg54
    Member
    Posted 8 years ago #

    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!)

    Thanks

Topic Closed

This topic has been closed to new replies.

About this Topic

Tags

No tags yet.