First Approach:
By default Avada does not provide the ability to upload a different logo for a specific page. A user can only upload a global logo in the Theme Options -> Logo section which cannot be sufficient in some situations where a user wants to upload a different logo for a specific page. With the help of this tutorial, you’ll be able to upload a different logo for your page other than the Global logo which comes from Theme Options. The good thing in the process is, Avada theme provides an option to use Custom CSS in the Fusion Builder of each page so you can get this done easily.
First you need to remove the global logo from the specific page and below CSS can be used in the Fusion Builder CSS area of your page where you want a different logo.
Once done, you need to install and activate a child theme in your website and edit the functions.php file by going to Dashboard -> Appearance -> Editor section. Then paste the below code at the very bottom of the functions.php file.
Now before saving the changes in there, you need to get the ID of your page, update the anchor link and the image link of the above code to your own ones. The ID should be of the page for which you want the different logo and a quick way to get the ID is to edit that specific page and you’ll see the numeric page ID number in the browser address bar.
Once you have made changes to Page ID, anchor link and the image source, save the changes in the functions.php file and you’ll see the changes taking effect. The logo will be now replaced with the image that you used in the code and the global logo of Avada will be removed.
Second Approach:
Just create a custom header for your page, if you’re using 7.0+ version of Avada and dive into the unlimited possibilities.
How To Build A Custom Header – https://theme-fusion.com/documentation/avada/layouts/how-to-build-a-custom-header/
Pre-built Headers For Layouts – https://theme-fusion.com/documentation/avada/layouts/prebuilt-headers-for-layouts/
Great snippet very usefull trick
I used and works perfectly
I am not a programmer
but I have 2 issue to solve
1 – how to change the logo on sticky menu
2 – if i want change logo on portfolio single page image I have to change this if(is_page( ’43’ )) in something else, isn’t it?
thanks in advance
If apply your snippet the sticky menu does’t work any more ;(
Perfect! the code works great but, maybe, it creates a conflict with fusion Slider, it doesn’t load. is it possible?
Thanks
Very unlikely that will be caused by this code. Fusion slider may have its own problem like missing width/height OR may be a JavaScript error is breaking it. You can check the browser console for that.
The css you mentioned above doesn’t remove the existing logo. Now I have two logos on my home page. Also how do I change logo on sticky header?
How exactly are you using adding the image in the header? Also make sure there is no CSS error in your old CSS and cache is cleared.
Like you mentione on this post https://theme-fusion.com/documentation/fusion-builder/how-to/how-to-add-custom-css-per-page-post/
I have cleared the cache too, but no progress
Try the CSS given above again, I have updated it. Should work.
This is exactly what I’ve been looking for, thank you!
One quick question: I’m trying to do this on multiple pages… and it works on the first page only.
The formatting is
if(is_page( ‘280’,’364′ ))
but only page 280 works, not 364. How would I get this fix on multiple pages?
Thanks!
You can use this: if( is_page( array( 280, 364 ) ) ) instead of what you had.
Thank you Luka :-)
Hi, I have the same size picture of the global logo and the one for a different page. Somehow the global logo is much smaller (the size what I want) than the logo what I have using the above code….
Please advise
The likely issue would be your image dimensions. If you are using any Retina logo then please make sure that is exactly twice the size of your original logo.
Thank you, yes that was the problem. Worked great thanks
After the new update of Avada theme. My logo disappeared :( do you know what could caused that?
Can you share the URL of the page where its not working? To reply privately, please submit the form on Contact page of this website.
Hello I am using the quad menu plugin in my site and I have tried this solution but it still shows the normal logo.
I was wandering if I need to follow a different solution with quad menu
I don’t think a menu will be relevant to this because its a completely issue. Normal menu will be removed only when you will use the CSS I gave in the solution.
Hi Muhammad,
Thanks for writing this up! What I put in the parts adds onto my domain url which results in an error. So for example if I put https://website.com, when you click on the link it comes out as:
“https://website.com/https://website.com”
Do you know how to fix this?>
Sorry, for the above I meant for the a-href link
Please make sure that the URL is added properly inside the href. If you can share the exact code you are using, I will be able to point out what is wrong in it.
Thank you.
Hi Muhammad,
Thanks for the quick reply! Here is the code:
add_action( ‘avada_logo_prepend’, ‘logo_image_home’ );
function logo_image_home() {
if( is_page( array( 2725, 2619, 2623, 2614, 2621 ) ) ) {
echo ‘‘;
}
When I’m on a page, say About Us, the logo points to this link:
http://site.staging.wpengine.com/about-us/“https://site.staging.wpengine.com/”
Sorry, the a href link above keeps getting left out of the comments. Here is a screenshot:
https://drive.google.com/open?id=1PHliwegPCVZGOMfo8_fYH9QuA3fUc8fC
Does it matter if I put in the Child Theme’s functions.php?
Please try the below code and then check it:
https://gist.github.com/hassan-tariq/ec3377e34e5263138057ae12f7c298b2
Hi Muhammad,
I had set both the standard logo and mobile logo through Avada theme options. The images are displayed based on the devices correctly but both images gets downloaded in the background. I would like to dynamically set the logo based on devices so that only one image is used. Please let me know how to achieve this.
Sorry, the loading of the logos cannot be avoided, they will be hidden though but not completely removed from HTML markup.
Hi Muhammad,
Thanks for your quick reply. Can I remove the logo from Avada theme options and is there a way to add this dynamically?
Hi, thank you so much for this!
Just one question: if i need 2 pages with 2 different logos, lets say my main logo is grey, but i need one in red and one in green – can i just copy and rename the function?
I got one logo to work, but the second stays blank somehow
Yes, that is possible, you simply need to copy and change the function name and it will work. If its not working then provide the exact code and I’ll look into it.
Thank you
Does this also change our x2 logo for Retina display? Or should we use an additional code for that?
Thanks and great code!
Woooo… That’s what I was looking for…!
Thank you Muhammad
i have a problem with the code, this the error:
Le tue modifiche al codice PHP sono state annullate a causa di un errore alla linea 771 del file wp-content/themes/Avada/functions.php. Correggi e prova a salvare nuovamente.
Cannot redeclare logo_image_home() (previously declared in wp-content/themes/Avada-Child-Theme/functions.php:15)
Actually you may have two functions named logo_image_home() in the same functions.php file. You may want to change the name of one of the function.
Not sure what I’m missing, but it must be something. So great you wrote this up to help people … maybe you can see what I’ve missed? This is the code I’ve put in the child functions.php:
add_action( ‘avada_logo_prepend’, ‘logo_image_home’ );
function logo_image_home() {
if(is_page( ‘611’ )) {
echo ‘‘;
}
}
and it’s Avada v 5.7.2 if that makes any difference
Actually you are echoing only an anchor tag without any text so there is no image or text. You will have to use an image HTML tag instead for displaying an image like my example. Notice the complete line #4 of my code above.
It looks like the past of my code removed the echo part. Let me give it another shot.
add_action( 'avada_logo_prepend', 'logo_image_home' );
function logo_image_home() {
if(is_page( '611' )) {
echo '';
if that didn’t work, this is the echo with syntax removed hoping it gets by
echo
okay, looks like both didn’t show the echo, so you can go to http://7oah.com/code.txt to see it
I am getting the echo content fine in my back-end. So content is correct and its supposed to work. Make sure your child theme is active. I don’t see it active on your website.
so weird! I did activate that thing but it wasn’t when I looked. I appreciate your help!!
No Problem :-)
Hello,
It works as it should but only on normal pages. But I also need it to work on product page (Woocommerce product page).
I inserted this code in functions.php:
add_action( ‘avada_logo_prepend’, ‘logo_image_home’ );
function logo_image_home() {
if(is_page(array(‘11319’, ‘11284’, ‘11249’))) {
echo ‘‘;
}
}
The product page is ID: ‘11284’, but for some reason it does not work on this page.
Please help me solve this issue.
Thank you.
Martin, you will have to use the is_product function for the products -> https://docs.woocommerce.com/wc-apidocs/function-is_product.html
Thank you for your help.
So I tried this code:
add_action( ‘avada_logo_prepend’, ‘logo_image_home’ );
function logo_image_product() {
if(is_product(‘11284’)) {
echo ‘‘;
}
}
But it still does not work. It is still the same as without this code.
Do you know where could be the problem?
In your code content, I don’t see the image HTML tag but only the anchor HTML. Please make sure to add the image HTML tag too within the anchor HTML.
Thanks. I got the code to work for the normal header but when I scroll to activate the sticky header, the logo disappears. How can I change the logo for the sticky header to match the new logo on the home page?
The code is supposed to work for Sticky Header too. Are you able to share the exact URL where I can see the set up so I can see if there is something obvious.
Hi Muhammad, can I send you a private message?
Hi Muhammad thanks for this helpful guide!
Not being a developer, my problem is that I don’t know how to fill the last line (the 4th) line of the second code in functions.php. I just know my the image link and not even sure where to put it. And what about the anchor link?
In other words i don’t know how to fill those 3 fields
href=
src=
data-orig-src=
thanks in advance!
Actually href will use the actual anchor link to which the image will be linked, while other two fields will use the exact link to the image file so just fill those with the relevant URLs.
I want to apply it to a single page and to all my portfolio pages so I tried this both specifing the IDs of the portfolio:
if((is_page( ’11’ )) || (is_archive()is_post_type_archive(array(146, 2433, 2533, 2594, 2738, 2813)))) {
and without specifing IDs (because i want to apply it for all the portfolio pages):
if ((is_page( ’11’ )) || (is_archive())) {
But it doesn’t work for page . Only the page 11. I really can’t understand why.
sorry the first line of code was
if((is_page( ’11’ )) || (is_archive(array(146, 2433, 2533, 2594, 2738, 2813)))) {
by the way I also tried “is_post_type_archive” instead of “is_archive” but nothing
Thanks a lot Muhammad! that’s exactly what I was looking for! You’re more efficient and quicker than any other paid customer support in the world :)
For anyone who is trying to have a different logo on a page while keeping the same logo on the sticky header for that page, I used the css image filter “invert” to change a black text logo (used throughout the site) to a white text logo used only on the home page.
Place this code in the custom CSS field for the page:
img.fusion-standard-logo {
-webkit-filter: invert(1); /* Safari 6.0 – 9.0 */
filter: invert(1);
}
This is an alternative to using Muhammad’s excellent code here, which unfortunately doesn’t allow you to choose a different sticky logo versus standard logo for the page–as the Avada theme does overall.
Does anybody know what is the correct wordpress conditional tag for a portfolio post (not a page)?
If anybody has the same problem “is_single( int|string|array $post = ” )” works fine for any post type, except attachments and pages
Hi,
This worked perfectly! Thank you.
But is it possible to apply exactly the same to the flyout menu?
Cheers,
Andy
Hi Muhammed! Thanks for the great solution.
I did what you did, but I have a problem which seems a bit confusing.
When I on fusion builder live frame, my logo appears perfectly and without any problem but when I switch mode to front-end mode, my logo disappears.
Why should it be?
Thanks again!
I’m not sure of that, I’ll have to check if its compatible with the Front-end Builder.
Hi,
This has been a saviour for me thanks!
How do I show the retina logo in the code as the mobile is showing slightly blurry and the retina one always fixes it when applied through the AVADA options tab.
You can use the srcset with 2x in it and define your image. you can follow this article on how to use srcset in image HTML -> https://css-tricks.com/responsive-images-youre-just-changing-resolutions-use-srcset/
you are a superstar. Thanks heaps mate
You’re welcome :-)
What if I only need to change the mobile header logo? what’s the php code?
Hi,
Can you help me with my code? I can’t get the new logo visible. Here is my code:
add_action( ‘avada_logo_prepend’, ‘logo_image_home’ );
function logo_image_home() {
if(is_page( ‘979’ )) {
echo ‘‘;
}
}
https://reemdesigntest.nl/kaatboere/wp-content/uploads/2019/10/Schermafbeelding-2019-10-02-om-17.39.52.png
Please use the image in the src value, that is not using a proper value right now.
Thanks! stupid mistake on my part
Hi,
Is it also possible to use a different mobile logo? I am using an minimalistic logo for the mobile menu.
Good day!
Muhammad, please help me.
I need to make a different logo on the site pages that are under site.com/ua/
How to do it?
I did php, but this don’t work on mobile version – link on code – https://codeshare.io/aVqrEQ and here – https://www.dropbox.com/s/p63z6syp90zmad1/logo.php?dl=0
This is great. I was able to set a different logo (white text) on the home page. Unfortunately, I need to keep the same logo (black text) as the rest of the site for the sticky header and mobile. Is this possible? thanks!
… great job, Muhammad!
The only thing we still need, is the possibility to change the logo for/in the sticky header.
We need another logo image for/in the sticky header, stead the standard logo.
Have you an workaround for this case?
Thanks for your quickly help.
I completely agree. How do we change the sticky header logo?
Hi Muhammed,
Great article and well thought out especially having the download of the child theme as a download. I have a little update to add if thats okay as I also was having trouble like a couple of other users with the Sticky Menu no longer working after addin in the code. After a little debugging I realised I needed to add the following retina_logo_url=”” withiin the img tag eg=> echo ‘‘;
Without it the browsers were throwing javascript errors.
Hope this helps.
thanks
Chris
codehub200
Thank you for sharing this code. I was able to get it to work perfectly on Pages. It does not work on posts, however. Could you tell me what modifications would need to be made to the code to get it to work with Posts as well as Pages?
Thanks in advance!
Thanks for some really useful code but it seems like so many people are asking the same question about the sticky logo.
I only need this action to work on my main header logo and I would like to keep the sticky logo as is but the css you suggest to insert in the firast instance removes it. How is it possible for me to change only the main logo and leave the sticky logo as is?
Hello there,
I am trying to change the logo on different portfolio posts, but the code is not working, should it be a different value than if_page or what? :(
Hi, i think that is possible to hide logo on all pages with only one css instruction in Avada Theme Options -> Custom CSS section.
Just add this (and change the ID’s for yours own):
/* Example for hide logo in more than one page */
.page-id-14249 .fusion-logo > a.fusion-logo-link, .page-id-14250 .fusion-logo > a.fusion-logo-link,
.page-id-14251 .fusion-logo > a.fusion-logo-link, .page-id-14252 .fusion-logo > a.fusion-logo-link,
.page-id-14253 .fusion-logo > a.fusion-logo-link, .page-id-14260 .fusion-logo > a.fusion-logo-link,
.page-id-14263 .fusion-logo > a.fusion-logo-link, .page-id-14265 .fusion-logo > a.fusion-logo-link,
.page-id-14284 .fusion-logo > a.fusion-logo-link, .page-id-14309 .fusion-logo > a.fusion-logo-link
{
display: none !important;
}
In addition, is possible to change the logo for all pages using an array in is_page function:
function logo_image_home() {
if(is_page( array(‘14254′,’14255′,’14256′,’14257′,’14258′,’14261′,’14264′,’14266′,’14287′,’14314′,’14249′,’14250′,’14251′,’14252′,’14253′,’14260′,’14263′,’14265′,’14284′,’14309’) )) {
echo ‘‘;
}
}
I think that is possible to store this array in post snippet or similar and capture it from functions.php. In this way, you can add more pages for change logo touching functions.php only one time.
Best regards, people!.
I’ve got round the sticky menu problem using media queries, you would have to adjust the margin-top value to match the height of the logo
@media only screen and (min-width: 1051px) {
.home .fusion-logo > a.fusion-logo-link {
display: none !important;
}
}
@media only screen and (max-width: 1050px) {
.home .fusion-logo > a.fusion-logo-link {
display: block;
margin-top: -80px !important;
}
}
If this is poor coding please improve it for me!
ignore last post, I was confusing this with the mobile menu
Hi,
I am trying to set a logo different to the default to an other page, but In vain. I have put the CSS on the page. I installed Avada Child and set the CSS but still the logo is not coming up. Could anyone help. Thanks.
Actually if you’re using Avada 7.0+ version then you can create a custom header for that specific page;
How To Build A Custom Header – https://theme-fusion.com/documentation/avada/layouts/how-to-build-a-custom-header/
Prebuilt Headers For Layouts – https://theme-fusion.com/documentation/avada/layouts/prebuilt-headers-for-layouts/
Hi,
How can change the setting (title background color, and also the padding) of the Event Calendar widget. Could anyone help`?
Germain
Hi there, may I ask what cause my logo disappeared after new update?
Can’t be sure about that but you should go with the second approach that I mention in my updated post, it will be update proof and long lasting.
[…] I figured it out using the instructions on this site, https://www.webzando.com/blog/how-to-have-a-different-logo-on-a-page-in-avada-theme/ […]