wordpress different header for different cateogy - where does it go?
Posted: Sat, 2008-03-01 03:47
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!
| Attachment | Size |
|---|---|
| INDEX-HEADER-PAGE.txt | 10.44 KB |


Moderator
Posts: 6781
Joined: 2004-05-01
Location: Brisbane
Like the author says, it
Posted: Sat, 2008-03-01 05:26
Like the author says, it goes in your header.php. It should come after the links to your other stylesheets.
How to get help
tags.
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
My articles | CSS Reference
Regular
Posts: 14
Joined: 2007-05-18
Sorry, i really don't know
Posted: Sat, 2008-03-01 06:03
Sorry, i really don't know much about php.... This is what is in my header....
<head>
<?php if ( is_home() ) { ?><title><? bloginfo('name'); ?> » <?php bloginfo('description'); ?></title><?php } ?>
<?php if ( is_search() ) { ?><title><? bloginfo('name'); ?> » Search Results</title><?php } ?>
<?php if ( is_single() ) { ?><title><? bloginfo('name'); ?> » <?php wp_title(''); ?></title><?php } ?>
<?php if ( is_page() ) { ?><title><? bloginfo('name'); ?> » <?php wp_title(''); ?></title><?php } ?>
<?php if ( is_category() ) { ?><title><? bloginfo('name'); ?> » <?php single_cat_title(); ?></title><?php } ?>
<?php if ( is_archive() ) { ?><title><? bloginfo('name'); ?> » Archive</title><?php } ?>
<?php if ( is_month() ) { ?><title><? bloginfo('name'); ?> » 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????