Here is a solution to have a different menus for each language with Polylang.
Step 1
First we have to create several templates. One header for each languages :
headerEN is my header with the menu in english. headerFR is my header with the menu in french. And headerAUTO is the one with the shortcode but we will create it later.
Step 2
Create the shortcode. You can add it in your own plugin or use the Code Snippets plugin :
add_shortcode( 'oxygen-template-header', 'func_oxygen_template_lang' );
function func_oxygen_template_lang( ) {
if (get_locale() == 'en_US') {
return do_shortcode( get_post_meta( 11, 'ct_builder_shortcodes', true ) );
} else if (get_locale() == 'fr_FR') {
return do_shortcode( get_post_meta( 14, 'ct_builder_shortcodes', true ) );
}
}
What does this shortcode do ? Well it's pretty simple. If the page is in english (US), it will insert the template 11. If the page is in french, it will insert the template 14.
To know the template number, you just have to check the link of the template :
Step 3
Now that we have our templates and the shortcode, we have to create the last template, that I called headerAUTO.
We simply add a shortcode element and put : [oxygen-template-header]
We save it and we choose Catch All as we want to be the header for all the website.
that's it. Now each page will show the right menu, according to the language of the page.