Viewing 8 posts - 1 through 8 (of 8 total)
  • Author
    Posts
  • #1296698

    Hello,

    I would like to place the WPML language switch under the burger icon. See image
    null

    #1297114

    Hey 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-1182955

    Best regards,
    Ismael

    #1297221

    Hello Ishmael,
    both variants do not work. I want the language switch to be placed under the burger icon.

    #1297471

    Hi,

    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,
    Ismael

    #1297944

    Hello 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.

    #1298176

    Hi,

    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,
    Ismael

    #1298372

    Hello 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 mobile

    null

    #1298877

    Hi,

    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

Viewing 8 posts - 1 through 8 (of 8 total)
  • You must be logged in to reply to this topic.