-
Hello everyone,
I have a bilingual website where a logo is set up as an image in the header. A different image is required for the English version.
In WPML I have created the English alternative for the image via “Media Translation”.
Shouldn’t this be displayed automatically in the header when I switch to the English version of the website? Instead the German version is still displayed.
If I set the website language to English in the Customizer and change the image in „Website information“, I then also have the English logo on the German website.
What is my error here?
Thank you!
-
David
Hi there,
it should swap automatically – can you share a link to where I can see the issue on your site ?
-
URL is in the private section. German and english logos are there but they don’t switch.
-
David
Ok, its most likely because you’re using the navigation as header and and mobile header.
Try this PHP Snippet to swap logos:
add_filter( 'generate_logo', function( $logo ) { if ( ICL_LANGUAGE_CODE == 'en' ) { return 'URL TO ENGLISH LOGO'; } return $logo; } );
For reference theres also some code for swapping mobile and sticky nav logos:
https://generatepress.com/forums/topic/elements-depending-on-language-with-wpml/page/2/#post-1842886
-
Tried both but nothing works …
-
David
Can you disable any image optimization on the site ? eg. caching / lazy loading, as the logos look to have been cached,
-
Every caching is disabled.
Just see that it works on mobile … The „Menu plus settings“-code does this. So desktop is still missing.
-
David
Is that with any of the codes applied ?
-
Yes, with the code on this URL: https://generatepress.com/forums/topic/elements-depending-on-language-with-wpml/page/2/#post-1842886
-
David
And if you add the code provided here:
https://generate.support/topic/change-logo-in-header-for-different-language/#post-118843
Does that apply to the desktop logo ?
-
No, that doesn’t work.
-
David
Can you remove the Retina Logo from the Site Identity ?
-
Perfect, that’s it. Will I miss the Retina Logo? It was the same size anyway.
-
David
Nope. Retina logo is from a bygone era. As most screens are now x2 or higher HD.
-
Fine. Thanks David!
-
David
You’re welcome
- You must be logged in to reply to this topic.