Ask your WordPress questions! Pay money and get answers fast! Comodo Trusted Site Seal
Official PayPal Seal

Unique Header for different categories (Quick Clarification) WordPress

  • REFUNDED

I need a unique header image for each category, i.e. red banner for cat1, blue banner for cat2, etc.

I already took the header away i just need some clarification on what was told to me before my web guy went on vacation...

NOTE: I don know anything about CSS or coding! Much detail is needed!

<blockquote>Instead of hard coding the image directly into the archive.php file, you simply need to add a div class in the area where you want the image to show.
Then via CSS you will need to add the proper code to assign a different header to the div class according to the page ID number
The ID number can actually be the category number. You can find it by looking at the body tag in the page source code.

So, for instance, the code would look like this for three different Categories:

.category-8 .customheader {background:url(http://www…)}
.category-11 .customheader {background:url(http://www…)}
.category-13 .customheader {background:url(http://www…)}

The div class would be place just above this line:

< div class="main-holder" >

Then the custom css can be placed in your site options > custom css or stylesheet style.css</blockquote>

As detailed as he put it i still don't understand exactly what code to put where... I need a step by step on where to put the CSS code and where to put the html code. And just a side note, I know NOTHING about CSS and can barely keep my head above water with HTML...

If you have any questions please feel free to email me at [email protected]

Answers (3)

2011-10-03

Julio Potier answers:

Hello

You can add the CSS code into the "style.css" in your theme directory.

The HTML code is in archive.php (as i read).

If you want i can have a look into your theme files, just grant me an admin access,

see you soon !


Lj Polin comments:

Ok, now i didn't include this in the original question but I'm am very NOT knowledgeable in coding and especially CSS. HTML I'm okay with...

So what "Code" do i put into the style.css exactly?

and then after that i get that i need to put a code on the actual archive pages(.php you said?) - what code is that?

2011-10-03

Linda answers:

Hi! If you are an admin, after you login you will see on the left hand side appearance. Under there is Editor. Click on that and style.css should be the first one to come up. That is where you put the css.

2011-10-03

Luis Abarca answers:

You can create header-{category-slug}.php, and include this way in your theme.

This way, if header-news.php doesnt exists, it uses header.php as fallback


<?php
... // get category

get_header($cat->slug)

?>