Viewing 7 posts - 1 through 7 (of 7 total)
  • Author
    Posts
  • #1463532

    Hi, I’m using “Enfold“ theme with the “Polylang” multilingual plugin. I’m trying to have another version of the main logo on my second language but I cant’ figure it out.
    Somebody knows how to have two different logo for each language version?

    Thanks for your help,

    Arthur

    #1463571

    Hey denisbarnabe,

    Thank you for the inquiry.

    Please use this filter in the functions.php file to change the logo for a specific language:

    function avf_logo_mod($logo)
    {
        $lang = pll_current_language('locale');
        if ($lang == "fr_FR") {
            $logo = "/wp-content/uploads/YOUR_LOGO_FILE.jpg";
        }
        return $logo;
    }
    add_filter('avf_logo', 'avf_logo_mod');

    Best regards,
    Ismael

    #1463598

    oh – nice; I didn’t realise that polylang has an extra for currentLanguage

    with get_bloginfo() you can have info on current language too.

    function change_logo_on_different_languages($logo){
        $currentlang = get_bloginfo('language');
        if($currentlang == "fr_FR"){
            $logo = "/wp-content/uploads/YOUR_LOGO_FILE.jpg";
        }
        return $logo; 
    }
    add_filter('avf_logo','change_logo_on_different_languages');
    #1463606

    Thanks for your responses Ismael and Guenni :)

    I tried to add this function to my theme but even after purged caches nothing changed on my FR version :/
    Do you think could be for the reason I’m using the two features “Logo” and “Logo Transparency” (when the user scroll another logo appears) ? Or maybe for the reason I’m using SVG file ?

    Thanks for your help :)

    Arthur

    #1463652

    Yes – and if you use for both logo svg files you can replace it by the ID of that logo file.
    you can find that ID on media library list view! ( it is an own column for that )

    try for default logo:

    function change_logo_on_different_languages($logo){
        $currentlang = get_bloginfo('language');
        if($currentlang == "fr_FR"){
            // see on media library what ID your Logo for Fr site has.
            $logo = 162;  
        }
        return $logo; 
    }
    add_filter('avf_logo','change_logo_on_different_languages');
    

    and for transparency logo:

    function av_change_alternative_logo_img($header){
        $currentlang = get_bloginfo('language');
        if($currentlang == "fr_FR"){
            // next line is only neccessary if on options no default transparency logo has been set
            $header['header_class'] .= ' av_alternate_logo_active'; 
            $header['header_replacement_logo_id'] = 163;
        }
        return $header; 
    }
    add_filter('avf_header_setting_filter','av_change_alternative_logo_img');

    or adjust Ismaels code that way with ID’s

    #1463670

    That works perfectly, thank you very much for your help Guenni! :D

    #1463707

    Hi,
    Glad that Guenni007 could help, thanks Guenni007, if you have any further questions please open a new thread and we will be happy to help.

    Best regards,
    Mike

Viewing 7 posts - 1 through 7 (of 7 total)
  • The topic ‘Translate Main Logo’ is closed to new replies.