Title: Multiple Header Images Using Single Template
Last modified: August 20, 2016

---

# Multiple Header Images Using Single Template

 *  [get_username](https://wordpress.org/support/users/get_username/)
 * (@get_username)
 * [13 years, 10 months ago](https://wordpress.org/support/topic/multiple-header-images-using-single-template/)
 * My goal is to just use the page.php template for all of my secondary pages, but
   I want to have a different header image for each section. This code should allow
   this so that the user doesn’t have to select a template in the admin panel.
 *     ```
       function my_different_header_images() {
       if (is_page('about')) {
       ?>
   
       <img src="<?php bloginfo('template_directory'); ?>/images/my-other-header.jpg"
       width="" height="" alt="" />
   
       <?php
       	}
       }
       add_action('hook_header_images','my_different_header_images');
       ```
   
 * My real question, if the above works, is how to tell all sub-pages of About to
   use that same header image? Is that possible with this code?

Viewing 2 replies - 1 through 2 (of 2 total)

 *  [zex2911](https://wordpress.org/support/users/zex2911/)
 * (@zex2911)
 * [13 years, 10 months ago](https://wordpress.org/support/topic/multiple-header-images-using-single-template/#post-2919972)
 * try to change second line to
 *     ```
       if (is_page('about') || $post->post_parent=="about") { ?>
       ```
   
 *  Thread Starter [get_username](https://wordpress.org/support/users/get_username/)
 * (@get_username)
 * [13 years, 10 months ago](https://wordpress.org/support/topic/multiple-header-images-using-single-template/#post-2919982)
 * Thanks, zex2911! I’ll give that a shot and see if it works.

Viewing 2 replies - 1 through 2 (of 2 total)

The topic ‘Multiple Header Images Using Single Template’ is closed to new replies.

 * 2 replies
 * 2 participants
 * Last reply from: [get_username](https://wordpress.org/support/users/get_username/)
 * Last activity: [13 years, 10 months ago](https://wordpress.org/support/topic/multiple-header-images-using-single-template/#post-2919982)
 * Status: not resolved

## Topics

### Topics with no replies

### Non-support topics

### Resolved topics

### Unresolved topics

### All topics
