Site logo

[Resolved] Change logo for each language – with polylang

Home Forums Support [Resolved] Change logo for each language – with polylang

Home Forums Support Change logo for each language – with polylang

Viewing 14 posts - 1 through 14 (of 14 total)
  • Author
    Posts
  • #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

    #323623
    Tom
    Lead Developer
    Lead Developer

    Does 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 } ?>
    #323678
    Collectif 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

    #323723
    Tom
    Lead Developer
    Lead Developer

    Did you check the “Execute PHP” checkbox?

    #323925
    Collectif WEB

    I did and i unchecked it too.

    #324231
    Tom
    Lead Developer
    Lead Developer

    Yet 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?

    #325703
    Collectif 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?

    #325722
    Tom
    Lead Developer
    Lead Developer

    Yes, if those are indeed the values WP sets, then that should work.

    #325739
    Collectif 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?

    #325911
    Tom
    Lead Developer
    Lead Developer

    Any chance you can link me to the site?

    #326126
    Collectif 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 🙂

    #326184
    Tom
    Lead Developer
    Lead Developer

    Glad you got it working! 🙂

    #353533
    sivan

    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?

    #353567
    Tom
    Lead Developer
    Lead Developer

    Perhaps Alexandre can chime in and let us know which solution he went with 🙂

Viewing 14 posts - 1 through 14 (of 14 total)
  • You must be logged in to reply to this topic.