December 24, 2023 at 6:02 am
I’m using Kadence and Polylang free with a multi-language site.
I’ve been trying to change the site logo based on the language of the current page but haven’t gotten it to work.
So far I discovered that I can change the logo URL with this in a code snippet:
add_filter( 'kadence_logo_url', 'polylang_get_multilang_logo' );
function polylang_get_multilang_logo( $value ) {
if ( function_exists( 'pll_current_language' ) ) {
$logos = array(
//'en' => wp_get_attachment_image('XXXX', 'full'),
//'he' => wp_get_attachment_image('YYYY', 'full'),
'en' => '/wp-content/uploads/Logo1.png',
'he' => '/wp-content/uploads/Logo2.png',
);
$default_logo = $logos['en'];
$current_lang = pll_current_language();
if ( isset( $logos[ $current_lang ] ) )
$value = $logos[ $current_lang ];
else
$value = $default_logo;
}
return $value;
}
Is there something similar to kadence_logo_url for changing the actual logo image not the URL it links to?
I also tried to use add_filter( ‘get_custom_logo‘, ‘polylang_get_multilang_logo’ );
But that isn’t fired for some reason.