I want to list all the menus from current language.
For example, I have a English-French bilingual site and I have 3 menus in total.
There are 2 English menus & 1 French menu.
(1) Primary Menu <- EN
(2) Quick Links <- EN
(3) Primary Menu French <- FR
Right now, I am able to list all of the menus, however, I only want the ones from the current language. If I am on the English side, it should list all the English Menus (Primary Menu + Quick Links), or if I am on the French side, it should list all the French Menus (Primary Menu French).
Below is the code that I'm using to list the menus:
$menus = wp_get_nav_menus();
foreach( $menus as $menu){
echo $menu->name."<br>";
}
How can I adjust the code above to display menus only from the current language?
I've tried using ' wp_nav_menu()', but it's not retrieving all the menu from a specific language. I normally use this to display a specific menu, however, I want to retrieve all the menu name/or slug from a certain language. If I am on the English side, it should list all the English menu names (such as Primary Menu, Quick Links), but it isn't.
I've used this code below, and it's returning NULL.
$menus = wp_nav_menu();
var_dump($menus);
Is it possible to retrieve all the menu names/or slugs from the current language?
I don't want to display a specific menu, but want to list ALL the menu names from the current language. For example, I have a English-French bilingual site and I have 3 menus in total. There are 2 English menus & 1 French menu.
(1) Primary Menu <- EN
(2) Quick Links <- EN
(3) Primary Menu French <- FR
I want to add a piece of code to the template that list ALL the English menus (the name or slug) when I am on the English side (which are Primary Menu & Quick Links ). When I am on the French side, it should list ALL the French menus (which is Primary Menu French ). However, wp_nav_menu() doesn't do this, as this code displays a specific navigation menu.