Reputation: 13
I want to add different header file to custom wordpress page template. I created a new template for custom post type. I want to add a header file to it using get_header() function, but do not want to use the regular header of the theme. I can paste the entire changed header file into the template, but I don't think that is the correct way. Any suggestions would be helpful.
Thanks
Upvotes: 1
Views: 2738
Reputation: 2401
You just create a different header file in you current theme just like header-custom.php
This example will include header-custom.php
<?php
get_header('custom');
?>
Upvotes: 0
Reputation: 1177
you can create the header file for every template, for example, to call header-blog.php: you need to get_header('blo');
Upvotes: 1
Reputation: 113
I would suggest only replacing the content in the header-file based on the template. You can therefore add a block just for the template "about.php" like this:
if(is_page_template( 'templates/about.php' ) {
//custom header for about.php
} else {
//Header for all other pages
}
Upvotes: 0