I want to use a different header on some pages of my WordPress website.
I’m using the code below to do this. I do
<?php get_header( $name ) ?>
I have two header-files in my directory: header.php and header-frontpage.php
Below you can also see a picture of my WordPress directory (just to give the best information)
The “main-template” of my page is build up in page.php. (you can find get_header(), get_footer(), … there). I changed the get_header() part code into:
if(is_front_page())
{
get_header();
}
else
{
get_header( 'others' );
}
This is working for me but only on the pages, not on post pages. I can do the same thing on the main-template for the post pages but is this correct? Can somebody assist me or am I doing
everything correct?
Thanks
I would do almost the same as you except for one thing. I would reverse the headers like this: