If you are using page templates in your theme, you can achieve this by creating different header.php
files and calling each of the headers using conditional tags.
Each of the header.php
files will have a different name like header-about.php
, header-contact.php
header-blog.php
Now inside your page template you should use the ifelse statement to now call the headers as follows:
if(is_page_template('about.php')){
get_header( 'about' ); // Calls the about page header
}
elseif(is_page_template('contact.php')){
get_header('contact'); // Calls the contact page header
}
elseif(is_page_template('blog.php'){
get_header('blog'); // Calls the about page header
}
else{
get_header();// Calls the default header is any other page is created
}
Each of these headers will have the different logo and different styles. This approach makes it easy for future updates since you will only have to edit the specific header.php
file.
!important
. It always causes problems down the road. As for the logo, this CSS only points to one image... what makes you think it would show a different image on different pages?