How to create different headers, footers, sidebars in WordPress theme

How to create different headers, footers, sidebars in WordPress theme, this is simple article for creating different headers, footers and sidebars in a WordPress theme. Here we can use WordPress page templates for using different headers, footers and sidebars in WordPress. If you want to create different header for news page then create a header template file with name of header-news.php

And then create a news page template with clone of page template, instead of normal get_header() function use get_header(‘news’);

get_header('news');

For creating different sidebar, create a copy of sidebar.php file with name of sidebar-news.php and load different widgets. Instead of get_sidebar function use get_sidebar(‘news’);

get_sidebar('news');

If you want to load separate footer for then it’s the same process, but now you have to create separate page template for footer with the name of footer-news.php. Then call get_footer() function with this one get_footer(‘news’);

get_footer('news');

I hope this article is helped to create different headers and footers for your WordPress theme using page templates.

Vivek Vengala
 

Vivek Vengala is a Online Entrepreneur, Web Developer from Hyderabad India.

Click Here to Leave a Comment Below 0 comments

Leave a Reply:

x

Join My Facebook Group to Receive Coding Tutorial for Free

email-subsribe