Different headers on each page
-
Hello,
I tried to follow the instructions of this post http://ww.wp.xz.cn/support/topic/different-headers-on-each-page?replies=21, but the result is what you can see on my website: http://www.qb-quantobasta.net. the header in duplicated, and on the-kitchen page the image which should be displayed it is not.can someone help me please?
thank you
Francesca
-
please post the full code of header.php of your child theme.
<?php /** * The Header for our theme. * * Displays all of the <head> section and everything up till <div id="main"> * * @package WordPress * @subpackage Twenty_Twelve * @since Twenty Twelve 1.0 */ ?><!DOCTYPE html> <!--[if IE 7]> <html class="ie ie7" <?php language_attributes(); ?>> <![endif]--> <!--[if IE 8]> <html class="ie ie8" <?php language_attributes(); ?>> <![endif]--> <!--[if !(IE 7) | !(IE 8) ]><!--> <html <?php language_attributes(); ?>> <!--<![endif]--> <head> <meta charset="<?php bloginfo( 'charset' ); ?>" /> <meta name="viewport" content="width=device-width" /> <title><?php wp_title( '|', true, 'right' ); ?></title> <link rel="profile" href="http://gmpg.org/xfn/11" /> <link rel="pingback" href="<?php bloginfo( 'pingback_url' ); ?>" /> <?php // Loads HTML5 JavaScript file to add support for HTML5 elements in older IE versions. ?> <!--[if lt IE 9]> <script src="<?php echo get_template_directory_uri(); ?>/js/html5.js" type="text/javascript"></script> <![endif]--> <?php wp_head(); ?> </head> <body <?php body_class(); ?>> <hgroup> <!--<h1 class="site-title"><a href="<?php echo esc_url( home_url( '/' ) ); ?>" title="<?php echo esc_attr( get_bloginfo( 'name', 'display' ) ); ?>" rel="home"><?php bloginfo( 'name' ); ?></a></h1>--> <h1 id="site-title"><span><a href="<?php echo esc_url( home_url( '/' ) ); ?>" title="<?php echo esc_attr( get_bloginfo( 'name', 'display' ) ); ?>" rel="home"><img id="site-logo" src="http://qb-quantobasta.net/wp-content/uploads/2013/02/QBLOGOnoMANO-e1363657719882.jpg" alt="" /></a></span></h1> <h2 class="site-description"><?php bloginfo( 'description' ); ?></h2> </hgroup> <nav id="site-navigation" class="main-navigation" role="navigation"> <h3 class="menu-toggle"><?php _e( 'Menu', 'twentytwelve' ); ?></h3> <a class="assistive-text" href="#content" title="<?php esc_attr_e( 'Skip to content', 'twentytwelve' ); ?>"><?php _e( 'Skip to content', 'twentytwelve' ); ?></a> <?php wp_nav_menu( array( 'theme_location' => 'primary', 'menu_class' => 'nav-menu' ) ); ?> </nav><!-- #site-navigation --> <div id="page" class="hfeed site"> <header id="masthead" class="site-header" role="banner"> <?php $header_image = get_header_image(); if(is_page('your-ideas')){ echo '<img src="http://qb-quantobasta.net/wp-content/uploads/2013/03/your-ideas.png" />'; } if(is_page('the-kitchen')){ echo '<img src="http://qb-quantobasta.net/wp-content/uploads/2013/03/The-Kitchen.png" />'; } else if ( ! empty( $header_image ) ) : ?> <a href="<?php echo esc_url( home_url( '/' ) ); ?>"><img src="<?php echo esc_url( $header_image ); ?>" class="header-image" width="<?php echo get_custom_header()->width; ?>" height="<?php echo get_custom_header()->height; ?>" alt="" /></a> <?php endif; ?> </header><!-- #masthead -->change this line to
elseifas well:elseif(is_page('the-kitchen')){it doesn’t work as well!
and also I cannot understand why on the only page it works it shows 2 headers…I tried to comment the last lines
else if ( ! empty( $header_image ) ) : ?> <a href="<?php echo esc_url( home_url( '/' ) ); ?>"><img src="<?php echo esc_url( $header_image ); ?>" class="header-image" width="<?php echo get_custom_header()->width; ?>" height="<?php echo get_custom_header()->height; ?>" alt="" /></a>but if I do it the website doesn’t even load…
ah no, now on Your Ideas it works…but still it doesn’t work on The Kitchen!
‘the_kitchen’ is set as the ‘posts page’ and therefore uses the conditional tag
is_home();
http://codex.ww.wp.xz.cn/Conditional_Tagsif(is_page('your-ideas')){ echo '<img src="http://qb-quantobasta.net/wp-content/uploads/2013/03/your-ideas.png" />'; } elseif(is_home()) { //check the 'posts page' = 'the-kitchen'// echo '<img src="http://qb-quantobasta.net/wp-content/uploads/2013/03/The-Kitchen.png" />'; } elseif ( ! empty( $header_image ) ) : ?> <a href="<?php echo esc_url( home_url( '/' ) ); ?>"><img src="<?php echo esc_url( $header_image ); ?>" class="header-image" width="<?php echo get_custom_header()->width; ?>" height="<?php echo get_custom_header()->height; ?>" alt="" /></a> <?php endif; ?>thank you very much!!!!! it works!!!!!
Hi, I’m also trying to get a different banner to appear on some pages of my site and not having much luck. This is one of the pages where I’d like a different banner:
http://www.drumdaboom.com/sound-therapy/
This is the code I put into the header:
<?php $header_image = get_header_image(); if(is_page('Sound therapy')){ echo '<img src="http://www.drumdaboom.com/wp-content/uploads/2013/03/banner_therapy.jpg" />'; } elseif ( ! empty( $header_image ) ) : ?> <a href="<?php echo esc_url( home_url( '/' ) ); ?>"><img src="<?php echo esc_url( $header_image ); ?>" class="header-image" width="<?php echo get_custom_header()->width; ?>" height="<?php echo get_custom_header()->height; ?>" alt="" /></a> <?php endif; ?>And this is the message I get …
Parse error: syntax error, unexpected ‘:’ in /customers/b/1/b/drumdaboom.com/httpd.www/wp-content/themes/drumdaboum/header.php on line 44
Any suggestions would be greatly appreciated.
The topic ‘Different headers on each page’ is closed to new replies.