How can I show different logos for different pages? I’ve been asked this several times. This time I’ll show you how to achieve this in the Divi theme.
- Compatibility 90%
- Ease of Use 78%
- Wow Factor 65%
You’re an IDIOT if you don’t use a child theme.
Step 1
Open header.php in the child theme folder. If it does not exist, copy header.php from the Divi theme folder into your child theme folder.
Step 2
Before we go crazy here, take a look at the WordPress codex page that details the methods to be employed. I won’t judge you if you choose not to 🙂 When you’ve steeled your nerves, pop open the toggle to reveal the code we’ll be adding to header.php.
Grab The Files
Take the easy road to success by grabbing header.php here and dropping ‘er into your child theme folder. Note: if you have edited your existing header.php, you won’t want to use my file 🙂
AWESOME! — thanks
Additional feature – what if you want to do for all POSTS (vs pages)… any suggestions?
You can edit single.php, which controls how posts are displayed. In that file, tell it to call a custom header.php that you creat.
I followed all the instructions and it didn’t work with a newer version of Divi… I copied the header.php from the Divi theme to my child theme and changed the code as shown in the video.
The code is PHP dependent, not Divi dependent. The code will work in Divi or any other themes. PHP can be tricky to work with. One missing comma, semicolon, bracket, parenthetical, or curly brace and you are hosed.
Any idea if it’s possible to do this for Woocommerce Product Pages?
Yes, absolutely.
Thank you so much for this! It is great. Any suggestions on how you would resolve it for mobile? Mine works 100% in desktop, but on mobile it is not great.
I had to set my logo to 110 pixels high for desktop, but then require it to be 54px high for mobile on only those specific pages?
Easy way is to use CSS. Find the selector by using your browsers inspector tool, then something like this in your child theme’s style.css file (you ARE using a child theme aren’t you?):
@media only screen and (max-width: 768px) {
#headerLogo {
height: 75px;
width: 75px;
}
}
Great solution, thank you very much!
Great! Thanks!
But, can I change the logo in 6 pages?
Yes, of course! Copy and paste the elseif section or add an array:
is_page( array( 42, ‘about-me’, ‘Contact’ ) );
Read More…
The code in the toggle has gone or is broken.
YIKES! Problem solved.
Hello, is it possible to change the direction page of the logo ? Like the logo on my home redirects to home and the logo on the page downloads redirects to downloads ?
Thank you so much !
Now Divi has theme builder functionality a better way of doing this would be by creating unique headers for each page. That will allow you to link each header’s instance of the logo wherever you want.