I’ve enounterd the need for this on several projects and thought it might help. In this case, I didn’t want the featured slider to appear on every page, as it was located in the header. You too, may want to display page-specific headers based on certain conditions. Well, it’s not that hard with the “if” and “else” statements. Get ready to learn some very basic PHP!
First, open your header.php file and copy and paste its contents into a new file. Name this new file “headerwithnofeaturedslider.php” or whatever is more semantic to you. Make sure you remove the offending featured slider portion (or include/remove what you want from this version of the header). Save and upload this new header file to your site.
Now you have two headers; you could easily make another, and another, and so on. Next we need to call them to appear on the pages in WordPress. In my case, I wanted to include the “headerslider.php” only on my home page and a unique header on my blog Every other page would load the normal header. So in my index.php file I replace the normal header tag with to include the new header file we created, like so:
What we have here is a code snippet that will load any of three headers depending on the page template used.
Let’s say that you wanted to load a certain header based on categories or tags even. You could do something like this:
All other pages will load the regular header. As you can see, it’s very simple. The most involving part would be changing your headers.