Archived topic
String translation for non retina logo
9 replies · Started by Yael on May 6, 2021
Hello,
Working with WPML and wanting to have different logo per language, following this
https://wpml.org/forums/topic/different-logo-image-per-language/#post-1654633
However, the only available string in GP is for retina logo, which I have "translated" per WPML instructions
However, the Hebrew English logo change is only working for me on 4 K; on 1080 p only the Hebrew language logo displays.
You can see the site here:
password protected so here's password to view site: meitar
As I said, on my 4k monitor, the logo changes to English / hebrew as expected but on my 1080 p only Hebrew language shows for both languages.
Is there another string perhaps to search for for non retina logo ( [generate_settings]retina_logo ) ?
Hi there,
try:
generate_settings[logo]
Alternatively Tom provides a PHP Snippet for swapping Logos based on language here:
https://generatepress.com/forums/topic/elements-depending-on-language-with-wpml/#post-1292891
Hello David, Unfortunately, there is no string translation available for [generate_settings] logo or generate_settings[logo]
https://gyazo.com/7f10ae9238dbd8f343bda1d4a224a63c
And the code snippet also didn't do the trick.
The default language is in Hebrew and the string translation for retina is I believe working
https://gyazo.com/af43350d6b401acd300845d9b4fbfd4e
But that only applies for 4k.
When I add the code snippet provided in link you shared, on 1080 p, in English, no logo displays
I'm not sure why this is turning out to be so complicated; from all the docs on WPML, it should be pretty easy :(
So the snippet option i provided above ie. this snippet:
add_filter( 'generate_logo', function( $logo ) {
if ( ICL_LANGUAGE_CODE == 'en' ) {
return 'URL TO ENGLISH LOGO';
}
return $logo;
} );
On this linereturn 'URL TO ENGLISH LOGO'; you need to replace that text with the full URL to the Logo eg.
return 'http://testsite.local/wp-content/uploads/2021/04/my-logo.jpg';
You can get the full URL from the media library.
Sorry for the frustrations - it should be easier then this - i am going to pass this onto Tom so he can take a look in case there is something i have overlooked. In the meantime give that a try and let me know
OMG, I feel so stupid! I'm so sorry!! My head is spinning -- this will be last ever multilingual site.
I added the correct url for logo in English -- honest, I did; but I'm still getting the Hebrew logo :(
I'm hoping it might be the cache -- although I've cleared everything under the sun.
Perhaps I need to remove the original string translation in WPML?
To clarify what is happening for me now:
All appears to be working on my 1080 p but not my 4 k monitor; 4k is only showing the Hebrew logo for both languages.
UPDATE: I restored the site from 8 hours ago to when the logo was working on 4k; and it is working :)
I've added the correct snippet now along with the url for my English logo but when I drag the tab from my 4k to my 1080 p only the English logo shows.
So what's been done is added WPML String translation for retina logo and added the snippet provided above for the English logo.
But I just can't get this to work on my 1080 p.
I'm only updated this ticket so it's clear what I've done and what the issue is that remains.
If you have any ideas how I can get this to work on non retina devises, I would be deeply grateful!
Ok set lets take it back a bit.
Can you remove the String Translation for the Retina logo.
And remove the Retina Logo from the Customizer > Site Identity.
Then just apply the snippet provided here:
https://generatepress.com/forums/topic/string-translation-for-non-retina-logo/#post-1768765
That in theory should remove the conflict between which logo should be processed - let me know.
I'm so grateful, David. That did it -- it's working in all my browsers and on both monitors. And since I'm using an SVG for the logo in customizer and in code snippet, there was no need to set the retina logo in customizer.
I can take a break from this for the weekend now, thanks to you!
Throwing flowers at your feet :)
Yael
That's great to hear ! Have a good weekend :)