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.

This thread is resolved. Here is a description of the problem and solution.

Problem:I try to add the language flags to the menu. But next to the flags it adds a text Language Swither to every menu.

Solution:if you go to WPML->languages-> choose the option to "Link to home of language for missing translations"

then go to WPML->Settings and enable "Translatable - only show translated items" for pages/posts

afterwards say you have a page called "test"

if i go to that page i will be redirected to the homepage of each language that does not have a translation

meaning if Spanish has a translation but Chinese does not it will show as following

http://www.site.com/es/test ---- http://www.site.com/zh-hant/ (takes you to homepage)

now if you wish to have the Chinese language to redirect to a specific page you might be able to do this with a redirection *plugin or custom* or with a custom language switcher.

do note that we cannot provide custom work solutions within the forum and that is why we recommend to contact our certified 3rd party contractors for any custom work. -> https://wpml.org/contractors/

Relevant Documentation:

This topic contains 9 replies, has 3 voices.

Last updated by sandorP-5 10 months ago.

Assigned support staff: Bobby.

Author Posts
November 6, 2018 at 7:36 pm #2882432

sandorP-5

Tell us what you are trying to do?
I try to add the language flags to the menu.
But next to the flags it adds a text Language Swither to every menu.
I hide it with css, but do I need to do it for every menu?

Is there any documentation that you are following?
Yes.

Is there a similar example that we can see?

What is the link to your site?
hidden link

November 6, 2018 at 8:02 pm #2882505

Marcos Vinicios Barreto
Supporter

Languages: English (English ) Portuguese (Brazil) (Português )

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

Hello,

Thank you for contacting WPML Support. You can customize what's included in your language switcher from your WordPress Dashboard > WPML > Languages menu as you can read at: https://wpml.org/documentation/getting-started-guide/language-setup/#language-switcher. There you have option to show name, flags only and other options. Please, let me know if you need any additional clarifications. Have a nice day.

November 6, 2018 at 10:12 pm #2882785

sandorP-5

Hello Marcos,

Yes, I did read that page you have sent.
But I cannot seem to find the answer how to hide the Language switcher text from the menu.
I send you an image.

November 7, 2018 at 12:11 pm #2885086

Marcos Vinicios Barreto
Supporter

Languages: English (English ) Portuguese (Brazil) (Português )

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

Hello,

Thank you for the updates. Regarding your issue it seems you have managed by yourself on hide the text 'Language Switcher' from your bottom menu (see attached image), although it still shows the language name next to every flag, if you need to hide it as you did with your top bar menu, you can proceed this way:

1 - Go to your WordPress Dashboard > WPML > Languages.

2 - Find your bottom menu language swticher and click the pencil icon to edit it.

3 - Now in the 'Edit Menu Language Switcher' popup window you have the options to choose what to show in your language switcher (see attached image).

Please, let me know if you need any additional instructions. Have a nice day.

November 7, 2018 at 9:07 pm #2887135

sandorP-5

Hello again,

I would like to have an official answer from you how to hide the "language switcher" text from the menu. Is there an option I can tick off?

Yes, I managed to hide it with css in the English top menu. In the bottom it disappeared. But in the Portuguese menu it is still there in he bottom menu.
Do I need to hide this tex in every language I create with css?

First of all: what is the purpose of this text? I cannot figure out. Maybe something I miss here....

One more question:
In chinese I will only have one page. I would like to redirect this page if they click the chinese flag. Now, if I click the chinese flag, I will read the English version of that page.
Can you help me out with this? Thank you.

Have a great day.

Zsuzsa

November 8, 2018 at 1:00 pm #2889435

Marcos Vinicios Barreto
Supporter

Languages: English (English ) Portuguese (Brazil) (Português )

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

Hello,

Thank you for the updates. In order to provide you with a definitive solution and more accurate answer I would need to have some access to your WordPress Dashboard, this would enable me to take a further look in your settings and this way identify your issue. For that, please consider:

I would like to request temporary access (wp-admin and FTP) to your site to take better look at the issue. You will find the needed fields for this below the comment area when you log in to leave your next reply. The information you will enter is private which means only you and I can see and have access to it.

Our Debugging Procedures

I will be checking various settings in the backend to see if the issue can be resolved. Although I won't be making changes that affect the live site, it is still good practice to backup the site before providing us access. In the event that we do need to debug the site further, I will duplicate the site and work in a separate, local development environment to avoid affecting the live site.

Privacy and Security Policy

We have strict policies regarding privacy and access to your information. Please see:
https://wpml.org/purchase/support-policy/privacy-and-security-when-providing-debug-information-for-support/

**IMPORTANT**

- Please make a backup of site files and database before providing us access.
- If you do not see the wp-admin/FTP fields this means your post & website login details will be made PUBLIC. DO NOT post your website details unless you see the required wp-admin/FTP fields. If you do not, please ask me to enable the private box. The private box looks like this: hidden link

Please, let me know if you need any additional details. Have a nice day.

November 9, 2018 at 2:26 pm #2893580

Marcos Vinicios Barreto
Supporter

Languages: English (English ) Portuguese (Brazil) (Português )

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

Hello,

Thank you for the updates. Regarding your request I would recommend the 'Skip language' option from your WordPress Dashboard > WPML > Languages > Language switcher options. It will only show the language menu item if there's a translation for the page, this way your visitors will only the chinese or russian flags if the page they are browsing in has a translation for these languages otherwise the flags will be hidden. Note: if you have duplicated content for these languages the flag will be shown as well even if no actual translation is done for these pages.

The other approach is with some custom code, you would need to create your own language switcher here, with a custom code you have a paramenter called 'link_empty_to' which should enable you to redirect to a custom url (in this case the chinese and russian pages) when the flag is clicked. You find the full details of this approach at: https://wpml.org/wpml-hook/wpml_active_languages/

Please, let me know if any further clarifications are needed. Have a nice day.

November 15, 2018 at 8:48 am #2909272

sandorP-5

Thank you for the answer.

The first approach would not work for me because that is what I want to avoid.
No matter where the visitor is on my page I would like to show them that there are content in certain language.
So if they click the flag on a page and there is no translated content for that page I would like to navigate them to the front page ofthat language.

I thought that this option should do that at the languageswitcher options: Link to home of language for missing translations. Or can you tell me what does this ceck box mean?

IfI go with the second option:
1. I add the second option to my functions.php
https://wpml.org/wpml-hook/wpml_active_languages/
2. How do I call the function?
3. How do I modify the URL so it is our main url+/{%lang}

Thank you for the help.

Zsuzsa

November 15, 2018 at 7:54 pm #2911361

Bobby
Supporter

Languages: English (English )

Timezone: America/Los_Angeles (GMT-07:00)

Hello,

Marcos is currently offline

if you go to WPML->languages-> choose the option to "Link to home of language for missing translations"

then go to WPML->Settings and enable "Translatable - only show translated items" for pages/posts

afterwards say you have a page called "test"

if i go to that page i will be redirected to the homepage of each language that does not have a translation

meaning if Spanish has a translation but Chinese does not it will show as following

hidden link ---- hidden link (takes you to homepage)

now if you wish to have the Chinese language to redirect to a specific page you might be able to do this with a redirection *plugin or custom* or with a custom language switcher.

do note that we cannot provide custom work solutions within the forum and that is why we recommend to contact our certified 3rd party contractors for any custom work.
-> https://wpml.org/contractors/

November 20, 2018 at 5:01 pm #2924107

sandorP-5

This is the exact solution I have needed. Thank you, Bobby!