Viewing 6 replies - 1 through 6 (of 6 total)
  • Plugin Author maximeschoeni

    (@maximeschoeni)

    Hello,

    Right, there’s a bug when language switch is used in more than one menu. I’am going to correct it in the next release. Thank you for pointing this.

    In the meantime you can use this code in your function.php to correct it:

    add_filter('wp_nav_menu', 'my_sublanguage_correct_menu_bug');
    
    function my_sublanguage_correct_menu_bug($nav_menu) {
    	global $sublanguage;
    
    	if (isset($sublanguage->menu_language_index)) {
    
    		$sublanguage->menu_language_index = 0;
    
    	}
    
    	return $nav_menu;
    }
    Thread Starter ehoever

    (@ehoever)

    When I add that code, the website gives an error.
    Any specific place in the file I need to insert the code?

    Thread Starter ehoever

    (@ehoever)

    Ok, suddenly it stopped giving errors. But still no English in the menu.

    Plugin Author maximeschoeni

    (@maximeschoeni)

    Actually you’re supposed to put one language item in menu for each of your languages. I think it will work if you put Dutch and English button.

    Now if you just want to have the opposite language button in the menu, there’s however a work around: you can set Nav Menu Item to be translatable in Sublanguage settings, then go to Sublanguage>Nav Menu Items and edit first language item and check “Hide this menu item in this language”

    Thread Starter ehoever

    (@ehoever)

    Thanks so much, this works perfectly!

    Thread Starter ehoever

    (@ehoever)

    Resolved

Viewing 6 replies - 1 through 6 (of 6 total)

The topic ‘No 2nd language in mobile menu’ is closed to new replies.