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.

Also Read: Create separate search forms for products, posts types and posts in WordPress

you can calll them in your templates like:

get_footer('customfooter');

get_header('customsidebar');

Also Read: Get custom post types 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.

Also Read: Create separate search forms for products, posts types and posts in WordPress

you can calll them in your templates like:

get_footer('customfooter');

get_header('customsidebar');

Also Read: Get custom post types in WordPress

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
18 Dec 2020

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

Sid
Sid
22 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

Close