-
AuthorPosts
-
April 26, 2021 at 9:53 am #1296698
Hello,
I would like to place the WPML language switch under the burger icon. See image
April 28, 2021 at 8:06 am #1297114Hey Markus,
Thank you for the inquiry.
You can use one of the snippets that we provided in the following threads, and modify it a bit so that the language switcher is rendered beside the icon menu.
// https://kriesi.at/support/topic/wpml-language-selector-in-main-menu/#post-314208
// https://kriesi.at/support/topic/wpml-language-switcher-offers-languages-in-which-no-content-is-available/#post-1182955Best regards,
IsmaelApril 28, 2021 at 8:30 pm #1297221Hello Ishmael,
both variants do not work. I want the language switch to be placed under the burger icon.April 30, 2021 at 7:00 am #1297471Hi,
Thank you for the update.
Add this snippet in the functions.php to render the flags inside the header.
function ava_icl_language_selector(){ $langs = array(); $languages = function_exists('icl_get_languages') ? icl_get_languages(): []; foreach($languages as $l){ $langs[] = '<a href="'.$l['url'].'">'.$l['code'].'</a>'; } echo "<div id='av-custom-lang-switcher'>"; echo join(' ', $langs); echo "</div>"; } add_action('ava_main_header', 'ava_icl_language_selector');
Then use this css code to adjust the position of the switcher.
#av-custom-lang-switcher { position: absolute; right: 50px; bottom: 0; }
Best regards,
IsmaelMay 3, 2021 at 9:13 am #1297944Hello Ismael,
Thanks for your help. The language switcher is now displayed correctly. Unfortunately, it is overlaid by the burger menu so that when I click on the language switch, the burger menu is opened.I have sent you the login details for the website.
May 4, 2021 at 7:32 am #1298176Hi,
Glad to know that it is working. To fix the overlap issue, try to set the z-index property of the language switcher.
#av-custom-lang-switcher { position: absolute; right: 25px; bottom: 10px; z-index: 9999; }
Thank you for your patience.
Best regards,
IsmaelMay 4, 2021 at 9:03 pm #1298372Hello Ishmael,
thanks that works now. Now I only have the problem that the mobile language switch slips into the burger icon. See image
It would be great if I could separate the settings for the desktop and the settings for mobileMay 7, 2021 at 8:29 am #1298877Hi,
No problem. Looks like you have also managed to adjust the style or position of the switcher on mobile using a css media query.
@media only screen and (max-width: 767px) { #av-custom-lang-switcher { position: absolute; right: 26px; bottom: -5px; z-index: 9999; text-transform: uppercase; font-size: 12px; } }
Best regards,
Ismael -
AuthorPosts
- You must be logged in to reply to this topic.