Create multiple headers, footers, sidebars for different templates in wordpress

Create multiple headers, footers, sidebars for different templates in wordpress

First copy and paste theme header.php file and rename it in your current theme. i.e. header-customheader.php . After that open header-customheader.php file and according to your needs change your header layout and functionality.

now open page template file and add the header-customheader.php file using below function where you want to show it.  

get_header('customheader');

 

you can create multiple headers for multiple pages. Same way you can create different footer.php, sidebar.php for different pages.

you can calll them in your templates like:

get_footer('customfooter');

get_header('customsidebar');

Hi, I'm Saurav, the developer behind usingphp. Donate to help me keep usingphp free and maintained.

Please let me know what your thoughts or comments are on this article. If you have any suggestion or found any mistake in this article then please let us know.

Latest Comments

Ravi shankar
Ravi shankar
17 Dec 2020

Thanks for the article. I've created 7 different headers for woocommere category becoz of my client`s requirements

Sid
Sid
21 Dec 2020

Thanks bro. I've created custom sidebar templates too. i.e. sidebar-customsidebar.php. Call sidebar in template sidebar('customsidebar');

Add your comment