Title: Load different header.php files on different pages?
Last modified: August 19, 2016

---

# Load different header.php files on different pages?

 *  Resolved [dmx09](https://wordpress.org/support/users/dmx09/)
 * (@dmx09)
 * [15 years, 4 months ago](https://wordpress.org/support/topic/load-different-headerphp-files-on-different-pages/)
 * Hi all,
 * I wondered if it’s possible to create a duplicate of my header.php, make some
   minor changes and load the amended header file on certain pages (just the homepage
   in this instance).. All other pages would load the default header.php.
 * So:
    <?php get_header(); ?> would load the usual header…
 * and:
    <?php get_header_new(); ?> would load my tweaked file…
 * would this work, or something similar?
 * Any advice appreciated!

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

 *  [mYrAn](https://wordpress.org/support/users/myran/)
 * (@myran)
 * [15 years, 4 months ago](https://wordpress.org/support/topic/load-different-headerphp-files-on-different-pages/#post-1867019)
 * You could make an if, something like this
 *     ```
       <?php if( is_page(19) ) {
       echo get_template_part( 'header', 'custom' );}
       else {
       echo get_header(); } ?>
       ```
   
 * That way, if the page id is 19 it’ll post the templatefile header-custom.php 
   instead of the usual header. You could substitute is_page()
    with e.g.
 *     ```
       is_page(array(1, 2, 3, 4, ))
       is_home()
       in_category(3)
       ```
   
 * And it loads what ever you write, like ding-dong.php would be echo get_template_part(‘
   ding’, ‘dong’ );}.
    You can also make elseif’s to have different conditions, 
   if you have multiple headers.
 * Havnt tested it out so i dont know if it’s working, but it should.
 * Though, if u only make small changes and know which pages the change should be
   active, you’re easier of by just doing this:
    `<?php if( is_page(2) ) { echo "
   settings for page 2"; } else { echo "settings for all other pages"; } ?>`
 *  Thread Starter [dmx09](https://wordpress.org/support/users/dmx09/)
 * (@dmx09)
 * [15 years, 3 months ago](https://wordpress.org/support/topic/load-different-headerphp-files-on-different-pages/#post-1867196)
 * That’s excellent, many thanks!

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

The topic ‘Load different header.php files on different pages?’ is closed to new
replies.

## Tags

 * [header](https://wordpress.org/support/topic-tag/header/)

 * In: [Hacks](https://wordpress.org/support/forum/plugins-and-hacks/hacks/)
 * 2 replies
 * 2 participants
 * Last reply from: [dmx09](https://wordpress.org/support/users/dmx09/)
 * Last activity: [15 years, 3 months ago](https://wordpress.org/support/topic/load-different-headerphp-files-on-different-pages/#post-1867196)
 * Status: resolved

## Topics

### Topics with no replies

### Non-support topics

### Resolved topics

### Unresolved topics

### All topics
