wordpress different header for different cateogy - where does it go?

zazi
avatar
rank Regular

Regular


Posts: 14
Joined: 2007-05-18

Hi there.....

I have the code that i am supposed to use to get a different header image for each category...

According to the author, the following code goes into the header.php file....

<style type="text/css" media="screen">
/* Calls the style sheets for each category */
<?php
$post
= $wp_query->post;
if (
in_category('3') ) {
include(
TEMPLATEPATH . '/category3.css');
} elseif (
in_category('4') ) {
include(
TEMPLATEPATH . '/category4.css');
} elseif (
in_category('5') ) {
include(
TEMPLATEPATH . '/category5.css');
} elseif (
in_category('8') ) {
include(
TEMPLATEPATH . '/category8.css');
} elseif (
in_category('13') ) {
include(
TEMPLATEPATH . '/category13.css');
} elseif (
in_category('15') ) {
include(
TEMPLATEPATH . '/category15.css');
} else {
include(
TEMPLATEPATH . '/style.css');
}
?>

</style>

<?php /* Calls the header image for each category - necessary code */
$post = $wp_query->post;
if (
in_category('3') ) {
$imgurl = "images/category3.jpg";
} elseif (
in_category('4') ) {
$imgurl = "images/category4.jpg";
} elseif (
in_category('5') ) {
$imgurl = "images/category5.jpg";
} elseif (
in_category('8') ) {
$imgurl = "images/category8.jpg";
} elseif (
in_category('13') ) {
$imgurl = "images/category13.jpg";
} elseif (
in_category('15') ) {
$imgurl = "images/category15.jpg";
} else {
$imgurl = "images/all.jpg";
}
?>

<style type="text/css" media="screen">
/* Disable the header style in the individual style sheets and embed it here. */
#header {
background: url(<?php bloginfo('stylesheet_directory') ?>/<?php echo $imgurl; ?>);
height: 120px;
margin: 0 auto;
width: 100%;
padding:0;
border: 1px solid #BEBEBE; }
</style>

***This code above, was taken from this post:
http://wordpress.org/support/topic/29434?replies=31
and you can see it in action here:
http://www.jbergdesign.com/***

I want to use this code, at my own blog which is here:
[url] http://wwwza-zi.com/wordpress/ [/url]

I have attatched a text document that includes my blogs php files:
-index
-header
-page

Can someone please tell/show me exactly WHERE to put the provided code in my blog files?

thanks!

AttachmentSize
INDEX-HEADER-PAGE.txt10.44 KB
Tyssen
Tyssen's picture
rank Moderator

Moderator


Posts: 6781
Joined: 2004-05-01
Location: Brisbane

Like the author says, it

Like the author says, it goes in your header.php. It should come after the links to your other stylesheets.

How to get help
Post a link. If you can't post a link, post ALL your code, both HTML & CSS. No server-side code; just the code sent to the browser.
Use tags.
My articles | CSS Reference

zazi
zazi's picture
rank Regular

Regular


Posts: 14
Joined: 2007-05-18

Sorry, i really don't know

Sorry, i really don't know much about php.... This is what is in my header....

<head>

<?php if ( is_home() ) { ?><title><? bloginfo('name'); ?>&nbsp;&raquo;&nbsp;<?php bloginfo('description'); ?></title><?php } ?>
<?php if ( is_search() ) { ?><title><? bloginfo('name'); ?>&nbsp;&raquo;&nbsp;Search Results</title><?php } ?>
<?php if ( is_single() ) { ?><title><? bloginfo('name'); ?>&nbsp;&raquo;&nbsp;<?php wp_title(''); ?></title><?php } ?>
<?php if ( is_page() ) { ?><title><? bloginfo('name'); ?>&nbsp;&raquo;&nbsp;<?php wp_title(''); ?></title><?php } ?>
<?php if ( is_category() ) { ?><title><? bloginfo('name'); ?>&nbsp;&raquo;&nbsp;<?php single_cat_title(); ?></title><?php } ?>
<?php if ( is_archive() ) { ?><title><? bloginfo('name'); ?>&nbsp;&raquo;&nbsp;Archive</title><?php } ?>
<?php if ( is_month() ) { ?><title><? bloginfo('name'); ?>&nbsp;&raquo;&nbsp;Archive</title><?php } ?>
<meta http-equiv="Content-Type" content="<?php bloginfo('html_type'); ?>; charset=<?php bloginfo('charset'); ?>" />

<meta name="generator" content="WordPress <?php bloginfo('version'); ?>" /> <!-- leave this for stats -->

<link href="<?php bloginfo('stylesheet_url'); ?>" rel="stylesheet" type="text/css" />
<!--[if lte IE 6]>
<link href="http://localhost/testblog/wp-content/themes/polaroidv2/images/png_fix_ie6.css" rel="stylesheet" type="text/css" />
<![endif]-->

<link rel="alternate" type="application/rss+xml" title="<?php bloginfo('name'); ?> RSS Feed" href="http://feeds.feedburner.com/feedburner/Thecraftylifewithzazi" />
<link rel="pingback" href="<?php bloginfo('pingback_url'); ?>" />

<?php wp_head(); ?>


</head>

But where and how do i paste the new code????