- This topic has 13 replies, 3 voices, and was last updated 8 years, 8 months ago by
Tom.
-
AuthorPosts
-
May 24, 2017 at 10:13 am #323557
Collectif WEB
Hey there!
I’d like to get different logos for the french and english version of my website.
I use Polylang.
What can I do to do that?Thanks a lot for your help
May 24, 2017 at 12:03 pm #323623Tom
Lead DeveloperLead DeveloperDoes Polylang have a conditional we can use to check the current language?
I found this function in WP, but not sure if it’s compatible with Polylang:
get_locale()So in GP Hooks, you could do this in the Before Header Content hook:
<?php if ( 'en_GB' == get_locale() ) { ?> <img src="URL TO en_GB logo" /> <?php } elseif ( 'fr_FR' == get_locale() ) { ?> <img src="URL TO fr_FR logo" /> <?php } ?>May 24, 2017 at 1:51 pm #323678Collectif WEB
Thanks a lot for your help.
This is the conditional we need to use.
but the result wasn’t that good. 😛https://ibb.co/j4GTfv
It added the logo :/
Did I miss something?Thanks again
May 24, 2017 at 3:55 pm #323723Tom
Lead DeveloperLead DeveloperDid you check the “Execute PHP” checkbox?
May 25, 2017 at 6:59 am #323925Collectif WEB
I did and i unchecked it too.
May 25, 2017 at 7:17 pm #324231Tom
Lead DeveloperLead DeveloperYet both logos show on the front end? We might need to find a different conditional. Can you ask polylang for an example conditional we can use?
May 29, 2017 at 9:18 am #325703Collectif WEB
I asked some developers friends, they said :
if( get_bloginfo( 'language' ) == 'fr-FR' )OR
if ( strpos( get_bloginfo( 'language' ), 'fr' ) !== FALSE )So if i undertand well, the code will be :
<?php if ( get_bloginfo( 'language' ) == 'en-US' ) { ?> <img src="URL TO en_GB logo" /> <?php } elseif ( get_bloginfo( 'language' ) == 'fr-FR' ) { ?> <img src="URL TO fr_FR logo" /> <?php } ?>Right?
May 29, 2017 at 9:45 am #325722Tom
Lead DeveloperLead DeveloperYes, if those are indeed the values WP sets, then that should work.
May 29, 2017 at 10:26 am #325739Collectif WEB
It kinda work. Like it doesn’t replace the logo, but add the logo just on its left.
So with CSS i deactivated the logo and placed the new one.
That should do BUT the problem is that this doesn’t replace the mobile logo too :/I’m not sure that this is the right way to do it, i may be wrong.
What do you think?May 29, 2017 at 7:20 pm #325911Tom
Lead DeveloperLead DeveloperAny chance you can link me to the site?
May 30, 2017 at 7:45 am #326126Collectif WEB
Hey Tom, i found out!
I didn’t use any hooks or some but some snippet on functions.php (i got help from a programmer).This is resolved (event if the hook didn’t work).
Thanks for your time & help Tom 🙂May 30, 2017 at 9:17 am #326184Tom
Lead DeveloperLead DeveloperGlad you got it working! 🙂
July 23, 2017 at 9:32 am #353533sivan
Hi, I’m looking for that too
I’m also using Polylang and want a different logo for the second language (the language that is not the site default)
What code should I use?July 23, 2017 at 10:13 am #353567Tom
Lead DeveloperLead DeveloperPerhaps Alexandre can chime in and let us know which solution he went with 🙂
-
AuthorPosts
- You must be logged in to reply to this topic.