Polylang – different logo for different languages
-
Hello all,
I’m having a bit of trouble using different logos for different languages on the website with the Polylang plugin.
Default language: en
Added languages: it, lt
I’ve tried the following:
https://ww.wp.xz.cn/support/topic/polylang-logo-change/
But I am unsure as to how to change the logo in the string translations (it does appear as an option, but can’t figure out how to change the actual logo, only has “841” as a string name in all languages)
I’ve also tried with the following code (after researching I found it for a different theme and did my best to replace all relevant elements to our own theme) by adding it to functions.php
I am unsure if I am doing this completely wrong, so by all means correct me!function zakra_polylang_get_multilang_logo( $value ) { if ( function_exists( 'pll_current_language' ) ) { $logos = array( 'it' => 'logo-latest.png', 'lt' => 'logo-latest-LT.png', ); $default_logo = $logos['en']; $current_lang = pll_current_language(); $assets_url = get_stylesheet_directory_uri() . '/assets/img/'; if ( isset( $logos[ $current_lang ] ) ) $value = $assets_url . $logos[ $current_lang ]; else $value = $assets_url . $default_logo; } return $value; } add_filter( 'theme_mod_image_logo', 'zakra_polylang_get_multilang_logo' );Replacing the logo page by page could also be an option, through the page editor, but since I’ve added custom css for the logo size and position, it apparently doesn’t take it into consideration when changing it through the page editor.
Thank you in advance for any help!The page I need help with: [log in to see the link]
The topic ‘Polylang – different logo for different languages’ is closed to new replies.
