Skip Navigation

This is the technical support forum for WPML - the multilingual WordPress plugin.

Everyone can read, but only WPML clients can post here. WPML team is replying on the forum 6 days per week, 22 hours per day.

Tagged: 

This topic contains 5 replies, has 2 voices.

Last updated by Lucas Vidal de Andrade 6 days, 10 hours ago.

Assisted by: Lucas Vidal de Andrade.

Author Posts
October 30, 2024 at 2:05 pm #16347620

Todd

Background of the issue:
I am redesigning a website that will be 99% English, with a single page for each of the languages in the menu switcher. I want the English menu to display in its entirety for all languages without manually creating the menu in each language, as this would require updating 10+ menus every time a page is added to the English menu.

Symptoms:
I found a few older tickets but they were confusing and hard to follow.

Questions:
How can I display the English menu for all languages without manually creating it in each language?

October 30, 2024 at 7:39 pm #16348984

Lucas Vidal de Andrade
Supporter

Languages: English (English ) Spanish (Español ) German (Deutsch ) Portuguese (Brazil) (Português )

Timezone: America/Sao_Paulo (GMT-03:00)

Hey there,

I'm still checking. I'll be back once I have new information. Thank you for your patience.

October 31, 2024 at 2:33 pm #16352215

Lucas Vidal de Andrade
Supporter

Languages: English (English ) Spanish (Español ) German (Deutsch ) Portuguese (Brazil) (Português )

Timezone: America/Sao_Paulo (GMT-03:00)

Hey there,

I tested the solution in a testing environment, and it worked like a charm. Note the in the first line of the code, you have to insert the menu location:

$locations_to_omit = ['header']; //Append menu locations here. e.g. ['primary', 'footer']

Based on what you shared, I put the location 'header'. Please check carefully the location of the menu you inserted, to see if it matches the variable that must be inserted there. It's the only part of the code that can/must be changed.

Make sure to have a full website backup and that this code is inserted at the end of your active theme's functions.php file.

Let me know how it goes.

October 31, 2024 at 5:01 pm #16352835

Todd

Hi Lucas

I'm sharing two screenshots.

Dark is the functions.php and the code I added as you provided.

Light is header.php for the theme I'm using (Hello Elementor). If I'm reading and understanding it correctly, the location is 'header.'

So, what can be the problem now?

Maybe I set something incorrectly in WPML settings? Would you like admin access to check?

Thanks again!
Todd

Screenshot 2024-10-31 at 18.57.22.png
Screenshot 2024-10-31 at 18.58.28.png
November 1, 2024 at 3:31 pm #16355493

Lucas Vidal de Andrade
Supporter

Languages: English (English ) Spanish (Español ) German (Deutsch ) Portuguese (Brazil) (Português )

Timezone: America/Sao_Paulo (GMT-03:00)

Hey there,

I'm getting a second opinion with my colleagues. Unfortunately, this solution is outside the scope of our support. The correct way to proceed here would be to create a feature request. We cannot create custom code for customers. I sent you the code because I found it in an old internal ticket and thought it might be useful. If it's not working, you must correct it yourself, or ask us for the feature request I mentioned.

I'll see what's possible and will get back to you, ok?

November 1, 2024 at 5:32 pm #16355763

Lucas Vidal de Andrade
Supporter

Languages: English (English ) Spanish (Español ) German (Deutsch ) Portuguese (Brazil) (Português )

Timezone: America/Sao_Paulo (GMT-03:00)

Hey there,

I talked to my other colleagues and in this situation we can only offer the two options:

1. Duplicate the menus manually. To do that go to Appearance > Menus, click on the "+" sign to add menus in secondary languages, and insert the EN links and labels.
2. Via code. To do that, you can try editing the code we sent, so it works in your context, or check our professional contractors service, here:
https://wpml.org/contractors/

I apologize for not being able to find a quick solution. Since a workaround involves custom code and is not part of the set of features, we cannot help further. I'll check if we have some ongoing feature request, to add this ticket as reference.

Thank you for understanding.

This ticket is now closed. If you're a WPML client and need related help, please open a new support ticket.