Support » Fixing WordPress » Custom Headers and SideBars?

  • Hello

    I know how to make custom posts for categories but how do you create it for headers and sidebars?

    I tried the same technique for custom posts – that is using an index/single page and renaming it to a category (ex. category-28.php).

    any suggestions?
    thank you so much..

Viewing 10 replies - 1 through 10 (of 10 total)
  • I know how to make custom posts for categories

    hmmm… I don’t.
    You can create custom templates for categories, eventually.

    Try to describe accurately your desired end result 😉

    Basically, I would like a custom header (with it’s own img or masthead) for different pages —

    for example, the Contact Us page will have its own separate header than from the Index page.

    The same can be said for custom sidebars.

    I’m not sure what the technique is to create them.


    It can be done, using the conditional tags:

    If you change only the so-called header image, you can use a series of conditionals in the header.php and you are all set.

    If you need to change more than just the imaage, you’ll probably go with custom Page templates calling different header template file, e.g. header2.php
    Use this line (literally!)
    <?php include (TEMPLATEPATH . '/header2.php'); ?>

    The same would go for the sidebars:
    either use a conditional in the Page template(s) to determine which sidebar you want, or call the approrpiate sidebar2.php, sidebar3.php etc. with the code line above.

    Thank you very much Moshu!

    it worked.

    for anyone else who come across this problem, this is what you should put in your header (provided that in your style.css, you have “masthead” as the container for your header image):

    <div id=”masthead”
    <?php if ( is_page(40))
    echo ‘style=”background:url(;”‘;

    Hello, Sorry to bring this one back up, but I am not understanding something.

    I am wanting to do the same thing, and I understand that the answer for this is all over the Codex and the Forums, I have read all of them and just can’t seem to get them to work.

    I have a conditional in my ‘sidebar’ file that says:

    <?php if (is_home()) : ?>

    and then there is a ‘column three’ that makes the index page a 4 column layout with all of the other pages being 3 column.

    What I am trying to do is leave the left sidebar alone and make a different right sidebar for each of the categories (12 of them). I have an individual template for each category (using the ‘category-x.php’ method) because we will be styleing each of the 12 categories much differently than each other. As such, we would like a custom right sidebar for each, but leave the left sidebar alone.

    Everytime I try to place the conditional in the ‘sidebar.php’ file, it gives an error on both the index and the category page. don’t I need 12 sidebars and a conditional in each category template page ?

    Thanks in advance …

    practiced, studied hard, and fig’d it out. no i don’t need 12.

    You should really post your findings. It would help others in the community who have the same issue.

    Please do post it – I also would like to see the solution.

    Sure ! sorry, i’m not used to being asked; i’m usually the asker (is that a word?)

    it was actually real easy, and i’m not sure if this is the most efficient way to do it, but this is what i did:

    1) Each of the 12 categories got their own template called category-1.php, category-2.php, etc.
    2) In the template, i used this:

    <?php include (TEMPLATEPATH . '/leftsidebar.php'); ?>

    which is from the regular page and index templates. However, I created two new sidebars called ‘leftsidebarpage.php and rightsidebarpage.php’ and called those on each of the category templates

    3) I went back in and installed information that was unique to that category on the template ‘sidebars’.

    4) When the time comes and information that is completely unique needs to be in one of the sidebars, then i can create ‘rightsidebarpageREGIONX.php’ and call it

    it is still very much under construction, but here is a look at it: (check the ‘Regional Information’ links to see each of the categories). right now the right sidebar (which is what got me started on this) has Google ads in it, but that will be replaced with the unique information for each category (region)

    Wow, Puff, I’m impressed. With much anguish I learned a little about (x)html and CSS, now I tackle WordPress PHP! I’ve been beating my head against the wall for a couple weeks and finally managed to get some pages/a simple blog up and running!
    Congratulations. I’m bookmarking this thread.

Viewing 10 replies - 1 through 10 (of 10 total)
  • The topic ‘Custom Headers and SideBars?’ is closed to new replies.