Title: Custom template gets multiple header.php files
Last modified: August 20, 2016

---

# Custom template gets multiple header.php files

 *  [shaunwallace](https://wordpress.org/support/users/shaunwallace/)
 * (@shaunwallace)
 * [14 years, 9 months ago](https://wordpress.org/support/topic/custom-template-gets-multiple-headerphp-files/)
 * I have a custom template page called “serve” and I call a custom header.php file
   with get_header(‘serve’) within the template file and that works correctly but
   I also seem to be getting the default header.php file as well and I don’t want
   that file included in the custom template page. Any suggestions? I am not calling
   get_header() anywhere other than in the index.php file but even if I remove that
   call, I still get the default header.php file included somehow.

Viewing 1 replies (of 1 total)

 *  Thread Starter [shaunwallace](https://wordpress.org/support/users/shaunwallace/)
 * (@shaunwallace)
 * [14 years, 9 months ago](https://wordpress.org/support/topic/custom-template-gets-multiple-headerphp-files/#post-2289775)
 * **Edit to my last post**. I think I found out where the problem is but would 
   still like anyone’s thoughts on how to fix it. I have a couple custom post types
   that that I get using WP_Query() on my home page and I also am setting up a new
   WP_Query object on the “serve” page as well so when I comment out the code that
   gets the custom post type data within the custom template, I don’t have any problems
   but if I leave it, I end up getting calls to functions that are only called within
   the default header.php file. Is there a better way to get custom post type data
   and display that within the custom template files?
 * Here’s my code to get the post data and I am executing this within the header.
   php file and within the server-header.php file.
 *     ```
       $service_times = new WP_Query();
       $service_times->query( 'post_type=service_times' );
   
       //the loop
       while ( $service_times->have_posts() ) : $service_times->the_post();
           echo the_content();
       endwhile;
   
       // Reset Post Data to have Template Tags use the main query's current post again.
       wp_reset_postdata(); */
       ```
   

Viewing 1 replies (of 1 total)

The topic ‘Custom template gets multiple header.php files’ is closed to new replies.

## Tags

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

 * 1 reply
 * 1 participant
 * Last reply from: [shaunwallace](https://wordpress.org/support/users/shaunwallace/)
 * Last activity: [14 years, 9 months ago](https://wordpress.org/support/topic/custom-template-gets-multiple-headerphp-files/#post-2289775)
 * Status: not resolved

## Topics

### Topics with no replies

### Non-support topics

### Resolved topics

### Unresolved topics

### All topics
