Tagged: different logos, polylang, url change
-
AuthorPosts
-
July 18, 2018 at 3:31 pm #987047
Hi,
The logo on my website will be changed when I change language. Set it up via functions.php:
add_filter(‘avf_logo’,’av_change_logo’);
function av_change_logo($logo)
{
$lang = pll_current_language(‘locale’);
switch ($lang) {
case ‘fr_FR’:
$logo = “/wp-content/uploads/Logo_FR.png”;
break;
case ‘de_DE’:
$logo = “/wp-content/uploads/Logo_DE.png”;
break;
}return $logo;
}The problem is that clicking on the French logo calls the wrong URL (only “…/fr/” instead of “…/fr/home-4/”). Because the Polylang plugin works correctly, I think that the URL is accessed via the theme. Can this URL be customized?
July 19, 2018 at 8:47 am #987302Hi,
I don’t know why, but it works now. Problem solved.
Best regards,
EstherJuly 19, 2018 at 2:55 pm #987429Hi,
Did you make any changes to my website this morning? Because: now the problem exists again.
Thank you for your Feedback.Best reagards,
EstherJuly 19, 2018 at 6:34 pm #987566Hi,
Please try to add this code to your child theme functions.php file:
add_filter('avf_logo_link','av_change_logo_url'); function av_change_logo_url($link) { $lang = pll_current_language(‘locale’); if ($lang == 'fr_FR') { $link = "https://fallback.zugerberg-finanz.ch/fr/home-4/"; } return $link; }
Best regards,
DudeJuly 20, 2018 at 8:40 am #987732Hi Dude,
Thank’s for that… I replaced that line (wrong quotes):
$lang = pll_current_language(‘locale’);
Now it works perfectely :-)
Have a nice Day,
Best regards, EstherJuly 20, 2018 at 8:48 pm #988010Hi Esther,
Glad you got it working for you! :)
If you need further assistance please let us know.
Best regards,
VictoriaJanuary 19, 2020 at 9:18 am #1175967Hello,
is it solved in some of the recent updates? It seems to me that I have the same problem and even more.
I have Polylang Version 2.6.9 Enfold 4.7.1 and WP 5.3.2
Right now I have set the settings in Polylang to “The language is set from the directory name in pretty permalinks” and the link in the logo is not set correctly, but once I switch the settings to “The language is set from content” the whole this is broken and none of the links works as they should (Logo and flags)January 20, 2020 at 4:18 pm #1176342Hi,
@lucaus: It seems to be working properly when we check. The logo of both languages contain the appropriate links. Did you use the filter above?Best regards,
IsmaelMay 21, 2020 at 3:04 pm #1215013Hi,
For some reason, in my example, the logo does not accept this function:function pojo_polylang_get_multilang_logo( $value ) { if ( function_exists( 'pll_current_language' ) ) { $logos = array( 'sr' => 'logo1.png', 'en' => 'logo2.png', ); $default_logo = $logos['sr']; $current_lang = pll_current_language(); $assets_url = get_stylesheet_directory_uri() . '/assets/'; if ( isset( $logos[ $current_lang ] ) ) $value = $assets_url . $logos[ $current_lang ]; else $value = $assets_url . $default_logo; } return $value; } add_filter( 'avf_logo', 'pojo_polylang_get_multilang_logo' );
..persistently ignores the permalink and points to a non-existent page.
Thank for advice
DarkoMay 21, 2020 at 3:49 pm #1215027Solved !
Conflict between home page choices in wp-dashboard settings and Enfold Frontpage Settings cause that Logo URL get wrong prefix.
Regards
May 22, 2020 at 12:47 am #1215123Hey Dare_Care,
I’m glad this was resolved for you!
Best regards,
Jordan Shannon -
AuthorPosts
- You must be logged in to reply to this topic.