How to Create Separate Headers for Multiple Pages in WordPress

WordPress CMS has always been into talks due to its utmost ability to provide commendable opportunities to users who intend to achieve something different than the conventional web products. Well, yes, you can choose to modify WordPress CMS in any desired form so as to add new dimensions to the existing structure and functionality of your WordPress powered website/blog. Thanks to the easy availability of multiple themes and plugins, it has become a lot more convenient to inject a range of features and options to enhance the visibility and usage of your web portal.


Headers is a default feature of WordPress that can be revamped for a brand new look and feel. You can opt for adding and modifying WordPress headers for being able to add text, labels or any other elements that you intend to display towards the top of your website. And that’s not all, you can go ahead with creating separate headers for individual pages incorporated into your WordPress website. You can render these headers using a specific set of code.

In this post, I’ve made an attempt to familiarize you with the simple-to-follow method to create separate headers for multiple pages in WordPress. Read on to find more about the steps involved with the same!

Which all purposes are solved using different WordPress headers?

You can leverage different WordPress headers for showcasing a certain piece of information that is relevant only to the WordPress page under focus. Don’t forget that the new header designed for a particular WP page wouldn’t be displayed on other pages that are available within the WordPress website. Yet another commendable  purpose that’s met via different headers is the need to display different menu sets on the website’s homepage as well as inner pages. For making this possible, you’ll be required to create two different menus via the WordPress back-end panel. These two menus can further be allotted to their respective headers. Last, but definitely not the least, hosting a marketing campaign on a targeted page becomes easy with the creation of a separate header.

And now, coming to the steps that need to be followed for creating separate headers for different WordPress pages

Step 1-

Create your new PHP file and give it a suitable name. In this tutorial, I’ve named my PHP file as header-your-page.php. Now, for calling a specific header, simply open your page template file i.e. page.php and replace the default header code with the one displayed below:




if(is_page(25)) {



else {





In the above code, I’ve used get_header functionality as per which I’ve created a custom file named header-your-page.php and used if(is_page(27)) as the ID for the page for which a new header needs to be created.

Yet another important point that needs to be noted here is that get_header(‘home’) is exactly the same alias that was being used for creating “header-your page name.php file. Here, the name of PHP file is haeder-about.php.

To sum it up, the above code snippet simply informs WordPress that each time a visitor opens the ‘About’ page, then the file named header.about.php needs to be displayed. However, if no header.about.php exists in the website’s database, then WordPress needs to serve the default header file for the ‘home’ page.

A quick look at editing existing WordPress headers

In addition to availing the flexibility of creating new headers for different WordPress page, you may also opt for editing the existing WordPress headers by enriching them with a new dimension.

To get on with editing the WordPress headers, all you need to do is simply open the header file using a suitable photo editing software like Adobe Photoshop.

If you’re confused about finding the name of the header file, here’s an explanation for the same. Just right click on the header image, followed by selecting the option “view image”.

Once you’re done with clicking on this option, you’ll get to see the path to the header image in addition to its specific stored location on your web server. Next, save the header image and edit the header of header file.

Finally, reload the page and you’ll be able to see the modified header image on your WordPress webpage.

That’s it for this post!



Implementation of separate headers for different WordPress pages is a easy process involving simple code. Here’s hoping the above post would aid you the next time you’re planning to have a separate header for any of your WordPress pages.

Leave a Reply