Support » Fixing WordPress » logo change on language

Viewing 10 replies - 1 through 10 (of 10 total)
  • Hi,

    Have you tried to apply the solution presented here https://support.pojo.me/docs/polylang-change-logo-every-language/? It seems that the Polylang plugin doesn’t have an option for using a different logo for each language but this code might do the trick.

    yes i tried it but doesn’t work šŸ™

    Hi,

    I think I managed to find a way to make this change possible. All you have to do is copy this code:

    function custom_polylang_multilang_logo( $value ) {
    	if ( function_exists( 'pll_current_language' ) ) {
    		$logos = array(
    			'fr' => wp_get_attachment_image('1555', 'full'),
    			'ar' => wp_get_attachment_image('1556', 'full'),
    		);
    		$default_logo = $logos['fr'];
    		$current_lang = pll_current_language();
    		if ( isset( $logos[ $current_lang ] ) )
    			$value = $logos[ $current_lang ];
    		else
    			$value = $default_logo;
    	}
    	$html = sprintf( '%2$s',
                esc_url( home_url( '/' ) ),
                $value
            );
    	return $html;
    }
    add_filter( 'get_custom_logo', 'custom_polylang_multilang_logo' );
    

    to the functions.php file and upload the two logos to Dashboard ā†’ Media. Now, click on the French logo and get his ID (once the pop-up opens, the browser link will have a part like this item=1555 (it will be a different number on your website). Just get the number you have and replace 1555 on this line:

    'en' => wp_get_attachment_image('1555', 'full'),
    

    and do the same for the arabic logo and replacing the 1556 value on this line:

    'ar' => wp_get_attachment_image('1556', 'full'),
    

    Once you did all these changes, plese check your website and tell me how the logo looks.

    yes excellent
    it works
    thank you

    but the location of the logo still the same, it doesn’t move with RTL language.

    Radu Constantin

    (@raduconstantin)

    Hi,

    I think that this is a part that needs to be handled by the theme author. The logo will move to the right only if the theme does have support for RTL and it changes the order of the elements. This is a part that the multilanguage plugin is not controlling. Please try to reach out to the theme authors and ask them if the theme you’re using does have support for RTL.

    @raduconstantin, thanks for code.
    I was looking for this, if I need to change to logo using the theme settings I need to talk with the theme builder?
    How do I add link to homepage for the logo?

    • This reply was modified 7 months, 2 weeks ago by  mstudioIL.

    Hey,

    Yes, if the logo is added using some sort of theme option, you need to reach out
    to the theme author and ask him if there’s any way to have the logo different on each language.

    Regards,
    Radu

    Great, so your code do not have links to homepage?,
    I using oceanwp theme, maybe you all ready have a solution for it?

    Hey,

    I just checked the OceanWP theme and it seems that the logo is created a bit different (custom made by the theme author) and the code I created is not helping at all. In order to have a different logo for each language, you can reach out to the theme authors here https://wordpress.org/support/theme/oceanwp and see if they have any suggestion.

    Thanks,
    Radu

    Thanks, I will ask them

Viewing 10 replies - 1 through 10 (of 10 total)
  • The topic ‘logo change on language’ is closed to new replies.