Add multiple headers to your wordpress theme

Add multiple headers to your wordpress theme

By default, to include the wordpress header in all of your files you use this function:

[php]

<?php get_header();  ?>

[/php]

What this function does, it looks for the file called header.php inside the root folder of your theme.

But there comes a time when you need to add more than one header to your theme. This could be for many reasons, such as:

  • You want to use a different header for another page
  • You want to add another menu to that specific header
  • You need a different header structure for another page
  • and so on….

Anyway, it is real simple to add as many headers as you can using the following code snippet:

[php]

<?php
get_header(‘your_header’);
//replace your_header with your desired name(s)
?>

[/php]

Just like above, the function will now look for the file called header-your_header.php inside your theme root folder. This code can be used in any page/template you desire. Also you can add as many headers you desire inside your theme.

Leave a reply

0
Connecting
Please wait...
Send a message

Sorry, we aren't online at the moment. Leave a message.

Your name
* Email
* Describe your issue
Chat now

Need more help? Save time by starting your support request online.

Your name
* Email
* Describe your issue
We're online! Ask us anything!
Feedback

Help us help you better! Feel free to leave us any additional feedback.

How do you rate our support?