wp different header for each page

Do you want to use a different header for each page? this small tutorial will show you how you can use a different header for each page in your wordpress installation , you can even use this code to show a different sidebar or even different footer , i have had a client lately who wanted to show a different icon in the header for each of her wordpress pages and this works as well

1.Create the headers you want to use on different pages

in this tutorial we will create 4 headers , you can name them to whatever you want

2. copy the following code and place it at the very top in your theme (page.php) file

<   ?php
if (is_front_page()) { include('header1.php');}   // if its the homepage ( a page that you set it as the homepage
elseif (is_page('2')) { include('header2.php');}   //where (2) its the page id
elseif (is_page('3')) { include('header3.php');;}    // where (3) its the page id
elseif (is_home()) { include('header4.php'); ;}   // if its the posts page
else {get_header();}
? >

if you are creating more headers for more pages then you would need to add more :

elseif (is_page('# here')) { include('header name');}

if you have any question use the form below to comment and i will be happy to assist you in whatever you may have

Post comment as twitter logo facebook logo
Sort: Newest | Oldest

Beautifully done and does work! Thank you for your help. God Bless!