-
AuthorPosts
-
March 21, 2021 at 12:52 pm #1289435
Hello,
I am using Polyang to have 2 different versions of my website.
For the mobile menu, I have some small differences compared to desktop versions.I am using this code: https://kriesi.at/support/topic/polylang-and-different-mobile-menus/#post-1271395 to show different menu’s.
//show different mobile menu's according to language if ( wp_is_mobile() ) { function replace_wp_nav_menu( $args ){ if (get_locale() == 'en_US') { $args['menu'] = 401; } else { $args['menu'] = 375; } return $args; } add_filter( 'wp_nav_menu_args', 'replace_wp_nav_menu', 10, 2 ); }
But, the mobile version of the menu it is shown also for the footer and in the menu above the header.
I want to show a different mobile menu only for the main menu.
How can I change the code to achieve this, please ?March 23, 2021 at 10:02 pm #1289997Nobody ?
March 27, 2021 at 5:08 pm #1290752Hi,
Sorry for the very late reply, the mobile menu is created from the regular menu that is created in the WordPress menu option, it is not really another menu, so you should create a footer menu and a secondary menu, which is the menu used above the header and not shown on mobile, and then your two main menus for each language which will also be used for mobile menus.Best regards,
MikeApril 3, 2021 at 7:28 am #1292050Hi,
The way you describe it, is the way that I have made it.
However, the menu above the header and the footer menu, using the function above, is replaced with the main menu.
You can check the google cached version of my website to understand it better. Please see private links.April 3, 2021 at 5:50 pm #1292117Hi,
I checked your homepage again in my browser dev tools mobile emulation in both languages and included a screenshot below. So while I can tell the footer is different, the top bar looks the same to me in both languages. Can you post a screenshot of what is meant to be shown?Best regards,
MikeApril 17, 2021 at 4:02 pm #1294909The problem is that the mobile menu (ID=401 and ID=375 as in the code above) it is replacing the footer menu.
Do the footer menu should stay the same for desktop and mobile.Please see the screenshot.
April 18, 2021 at 4:10 pm #1295001Hi,
I believe it is your Polyang plugin that is changing your footer menu based on language, if you want to use the same footer menu for both languages then you will need to make this selection within the Polyang / menu options.
The menu IDs above are not for the footer menus.Best regards,
MikeApril 20, 2021 at 9:56 pm #1295619Without that piece of code in the functions.php, everything works good. So, it is not from Polylang.
Anyway, I solved the problem in the following way:
– I have selected the “Alternate Menu for Mobile” form Enfold theme option.
– I have reduced the code in functions.php to use the menu only fo English language.April 23, 2021 at 6:17 am #1296189 -
AuthorPosts
- You must be logged in to reply to this topic.