Setup different logo per language
-
Dear Stephane,
How to display different logo per language using Polylang? Maybe its possible to call it using Strings or is there any other solution?
…Also
I managed to find a code snippet for other plugin. As far I understand we can adopt it for Polylang if we find right function instead of “pll_current_language”.
What would be Polylang function to determine current language?function custom_polylang_multilang_logo( $value ) { if ( function_exists( 'pll_current_language' ) ) { $logos = array( 'en' => wp_get_attachment_image('8841', 'full'), 'ru' => wp_get_attachment_image('7679', 'full'), 'lv' => wp_get_attachment_image('11138', 'full'), ); $default_logo = $logos['lv']; $current_lang = pll_current_language(); if ( isset( $logos[ $current_lang ] ) ) $value = $logos[ $current_lang ]; else $value = $default_logo; } $html = sprintf( '<a href="%1$s" class="custom-logo-link" rel="home" itemprop="url">%2$s</a>', esc_url( home_url( '/' ) ), $value ); return $html; } add_filter( 'get_custom_logo', 'custom_polylang_multilang_logo' );
Kind regards,
The page I need help with: [log in to see the link]
Viewing 3 replies - 1 through 3 (of 3 total)
Viewing 3 replies - 1 through 3 (of 3 total)
- The topic ‘Setup different logo per language’ is closed to new replies.