Display different header images based on current page

On the else if there is missing a closing bracket: } elseif ( is_page(1) ) {.

Since all you alter is the file name, it’s sufficient to use the following code:

if ( is_home() ) $my_header_image = get_header_image();
elseif ( is_page(1) ) $my_header_image = "http://.../ImageB.png";
elseif ( is_... ) $my_header_image = ...;
else...
?>
<img src="https://wordpress.stackexchange.com/questions/89451/<?php echo $my_header_image; ?>" width="<?php echo $header_image_width; ?>" height="<?php echo $header_image_height; ?>" alt="" />

Leave a Comment