Conditional tags in header.php code for custom header on pages
-
Hi,
I used the method described here to get a different header image depending on what page a visitor is on.
My page is here.
I think it is working, but there are broken image icons on top of the default header images. I am not sure if my image path is wrong (I’m sure that it is correct though) or if I have missed something in integrating it into the page.
Below is the code for header.php:
<?php /** * @package WordPress * @subpackage Default_Theme */ ?> <?php if(is_page('2')){ echo '<images/header-about.jpg" />'; } ?> <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "https://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"> <html xmlns="https://www.w3.org/1999/xhtml" <?php language_attributes(); ?>> <head profile="https://gmpg.org/xfn/11"> <meta http-equiv="Content-Type" content="<?php bloginfo('html_type'); ?>; charset=<?php bloginfo('charset'); ?>" /> <title><?php wp_title('«', true, 'right'); ?> <?php bloginfo('name'); ?></title> <link rel="stylesheet" href="<?php bloginfo('stylesheet_url'); ?>" type="text/css" media="screen" /> <link rel="pingback" href="<?php bloginfo('pingback_url'); ?>" /> <?php if ( is_singular() ) wp_enqueue_script( 'comment-reply' ); ?> <?php wp_head(); ?> </head> <body <?php body_class(); ?>> <div id="wrapper"> <div id="small_slide"><img src="images/small_slide.png" width="431" height="249" /></div> <div id="header"><img src="images/header.jpg" width="899" height="283" /></div>
Can anyone see something noticeably wrong?
Viewing 7 replies - 1 through 7 (of 7 total)
Viewing 7 replies - 1 through 7 (of 7 total)
- The topic ‘Conditional tags in header.php code for custom header on pages’ is closed to new replies.