• I’d appreciate a bit of help in getting my site to display different headers on some pages. I’ve read various posts, including this one:

    http://wordpress.org/support/topic/different-headers-on-each-page-1?replies=10

    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.

Viewing 2 replies - 1 through 2 (of 2 total)
  • you are mixing two differnt syntaxes in your if/elseif structure;

    try:

    <?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; ?>

    in your code, you are losing the link on the header image for the selected images;

    to keep the link, try:

    <?php $header_image = get_header_image();
    		if(is_page('Sound therapy')) :
    		echo '<a href="' . esc_url( home_url( '/' ) ) . '"><img class="header-image" src="http://www.drumdaboom.com/wp-content/uploads/2013/03/banner_therapy.jpg" alt="" /></a>';
    		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; ?>
    Thread Starter TriciaB

    (@triciab)

    Thank you so much – working!

Viewing 2 replies - 1 through 2 (of 2 total)
  • The topic ‘Different headers Twenty Twelve theme’ is closed to new replies.