Plugin Author
Chouby
(@chouby)
Did you create your languages ? Almost everything is disabled before languages are created.
First thanks for the cuick response.
Yes, I have created the languages. What I dont have is the register of a zone menu in the function.php file.
Is this nesesary for the plugin to work?
Chouby
I have found the fix. Please add this to the doumentation.
I ussualy use the menus without giving the user the posibility to select the theme position.
But with this plugin the register_nav_menus has to be used in the functions.php file for the Menu tab to show at Languages settings.
That was very important. I have follow the example in here for this to work.
Thanks for your time.
Plugin Author
Chouby
(@chouby)
I should have thought to this first !
Yes. You need to have the ‘register_nav_menu’ to use custom menus. Otherwise you get ‘The current theme does not natively support menus, but you can use the “Custom Menu” widget to add any menus you create here to the theme’s sidebar.’ in the menus admin panel and I deactivate the menus settings for Polylang.
However it may help you to know that the plugin is compatible with ‘wp_page_menu’ (which does not need the ‘register_nav_menu’), although in that case you can’t add the language switcher to the menu.
How do you use the menus without giving the user the possibility to select the theme position ?
In my case the menus are not added by a widget. so I create the menu from WP and then I call it with the wp_nav_menu() function.
Plugin Author
Chouby
(@chouby)
So if I well understand, you hardcode the menu in the theme. Something like
wp_nav_menu(array('menu'=> 'your_menu', 'theme_location' => 'your_location'));
In this case, I don’t know how to replace ‘your_menu’ by ‘your_menu_fr’ or ‘your_menu_en’ depending on the current language.
Exactly I do it like
wp_nav_menu(array(‘menu’=> ‘your_menu’));
and with others parameters but not using the theme location.
Nevertheless It dosen’t matter. I can still register the menu and use the menu location without letting the user change it.
It works prefect.
Thanks
I do recommend to put this matter into the documentation. To have the menu registered