Getting a Custom Header for Page Template

So you are creating a new page template and need to call a different header? Or maybe you are on a specific page and it needs a different header. What ever the case is, here is how you do it.

WordPress has its own unique way of calling custom headers. So lets say you made a duplicate of the default header and change the name. In my case, I will rename it “header-custom.php“.

If you are creating a new page template you would do the same thing and make a duplicate of the “page.php” file in your theme folder. For this example, I will name mine “page-custom.php

In your new template file look for get_header();

To add your new header, all you need to do is to add the name of that header AFTER the dash. So in my example, my new header is called “header-custom.php”.

So my new header call will be: get_header(“custom”)

And THAT is it!

HOW TO WRITE IT (and how to NOT write it):

YES: get_header ( “custom” )

NO: get_header ( “header-custom” )

NO: get_header ( “header-custom.php” )

NO: get_header ( “customheader.php” )

NO: anything else

0 replies

Leave a Reply

Want to join the discussion?
Feel free to contribute!

Leave a Reply

Your email address will not be published. Required fields are marked *

Enter Security Code *