Viewing 18 posts - 1 through 18 (of 18 total)
  • Author
    Posts
  • #1369265

    Hi there!
    Is it possible to change the logo of my main menu depending on the language? In my case, it should switch between Spanish and German.
    Thanks in advance
    Arantza

    #1369269

    Hey asociacionespanolaaustria,

    Yes, you can do that in the theme option under each selected language when running WPML.

    Best regards,
    Rikard

    #1369279

    Thank you for your answer. I worked with Polylang

    #1369285

    It is not possible to change the logo. Can you please help me?

    #1369289

    Hi! In the theme option, I only have the possibility of loading a Logo. I can not change it for different languages.
    What should I do

    #1369353
    This reply has been marked as private.
    #1369358

    i do not know if polylang has some classes on body for each language – but on htm there is that lang attribut you can check.
    you then can use a filter to change logo with an if clause checking for lang:

    function change_logo_by_lang($logo){
      $currentlang = get_bloginfo('language');
      if($currentlang=="en-GB"){
        $logo = "/wp-content/uploads/YOUR_LOGO_FILE.jpg";
      }
      return $logo;
    }
    add_filter('avf_logo','change_logo_by_lang');

    by that you can even differ on f.e.: en-US, en-CA, en-AU, en-GB, en-UK

    #1369364

    no chance :(
    thank you anyway
    best regards
    Arantza

    #1369367

    I for one test almost all my advice beforehand.
    So as long as you have a lang attribute to html, it should work.
    As I said – I don’t have Polylang running on a test installation, so I don’t know how Polylang switches between languages, but I can’t imagine the lang attribute not being set. WPML does it that way, anyway.

    The lang attributes can be determined using the developer tools, and the path to the alternative logo must of course be replaced.
    If you use transparent headers, which you didn’t mention, you won’t see the actual logo at the beginning.

    if you try to substitute the transparency logo on some pages use

    function replace_transparent_logo_on_some_pages($header){
        $currentlang = get_bloginfo('language');
        if($currentlang=="de-DE"){
            $header['header_replacement_logo'] = "/wp-content/uploads/YOUR_ALTERNATE_LOGO";
        }
        return $header; 
    }
    add_filter('avf_header_setting_filter','replace_transparent_logo_on_some_pages');

    i tested this – but if there is set on “Transparency Options” a svg as logo – this will not replace this. It seems that the replacement of the img svg to an inline svg hampers that filter from changing the output.

    #1369562

    Hi,

    Thanks for helping out @guenni007 :-)

    Best regards,
    Rikard

    #1369565

    Guenni007 is a real asset..:)

    #1369570

    i tested this – but if there is set on “Transparency Options” a svg as logo – this will not replace this. It seems that the replacement of the img svg to an inline svg hampers that filter from changing the output.

    i do not know if i could avoid it by giving to the function a high priority ( low numbers : 10 )

    #1375329

    Hi,
    I am using polylang for de and en pages and everything works fine, BUT:

    Clicking on the LOGO on any english page I get a wrong link to the english HOME. (The HOME-button in the menu works fine.)
    How can I change the LOGO-Link on my english pages leading me to my english HOME page?

    #1375410

    can you try something like this:

    function av_change_logo_link_for_language($link){
        $currentlang = get_bloginfo('language');
        if($currentlang=="en-US"){
            $link = get_site_url().'/?lang=en';  // you know your permalink structure better than me
        }
        return $link; 
    }
    add_filter('avf_logo_link','av_change_logo_link_for_language');
    #1375919
    This reply has been marked as private.
    #1375971

    Hi,

    Could you please try copying the code from here – https://pastebin.com/9dZhSu7Q.

    I tested it on my local installation and it works as expected.

    Best regards,
    Yigit

    #1376037

    Hi Guenni, Hi Yigit,

    Now it works! Thanks for your perfect and fast support.
    No idea what went wrong before.

    Best,
    Markus

    #1376040

    Hi,

    You are welcome! Let us know if you have any other questions and enjoy the rest of your day :)

    Best regards,
    Yigit

Viewing 18 posts - 1 through 18 (of 18 total)
  • The topic ‘Different Logo for different languages’ is closed to new replies.