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;
}
When I add that code, the website gives an error.
Any specific place in the file I need to insert the code?
Ok, suddenly it stopped giving errors. But still no English in the menu.
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”
Thanks so much, this works perfectly!