Skip Navigation

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

Problem:
I added a language switcher with:

do_action( 'wpml_add_language_selector' )

Where can I customize it in the dashboard?

Solution:
The do_action('wpml_add_language_selector') action outputs the language switcher based on the options set in the "Custom Language Switchers" section in "WPML > Languages".
- Go to that section and make sure the switcher is enabled
- Click on "Customize", and make sure that "Language name in current language" is not selected
- Click on "Save"
- Clear any cache you may have

Relevant Documentation:
https://wpml.org/wpml-hook/wpml_add_language_selector/

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 topic contains 6 replies, has 2 voices.

Last updated by Nicolas V. 1 year, 3 months ago.

Assisted by: Nicolas V..

Author Posts
September 13, 2023 at 2:39 pm #14390867

Swen Kleibrink

Hi we want to change something and the theme developer is very slow but also maybe he needs some reference
He is calling
do_action( 'wpml_add_language_selector' ) in an elementer widget
but in the image it shows the

Language name in current language (I think it is what it is called)

but the company does not want that

how can we hide it ?
css?

thanks

4c071369-af2e-4422-a936-f6f73f106697.jpg
September 13, 2023 at 3:04 pm #14391029

Swen Kleibrink

this is his ct-icon-widget php elementor template hidden link

this is his site-lang.css file hidden link

maybe is something I can share with him as a theme developer or change myself ?
Thank you

September 14, 2023 at 3:24 pm #14398009

Nicolas V.
Supporter

Languages: English (English ) French (Français )

Timezone: America/Lima (GMT-05:00)

Hello,

Welcome to the WPML support forum.
The do_action('wpml_add_language_selector') action outputs the language switcher based on the options set in the "Custom Language Switchers" section in "WPML > Languages".

- Go to that section and make sure the switcher is enabled
- Click on "Customize", and make sure that "Language name in current language" is not selected
- Click on "Save"
- Clear any cache you may have: from plugins or server sided
- Even cache from WPML: In "WPML > Support > Troubleshooting (link)", click on "Clear the cache in WPML"

Let me know how it goes.
Nico

September 14, 2023 at 5:58 pm #14399151

Swen Kleibrink

Thanks this worked.. I wish this was in your documentation on that hook. Would of saved us time. Hopefully it will help someone else.

September 14, 2023 at 6:06 pm #14399167

Nicolas V.
Supporter

Languages: English (English ) French (Français )

Timezone: America/Lima (GMT-05:00)

Hi,

I'm glad we solved the issue. By the way you can find the full documentation in our getting started section here: https://wpml.org/documentation/getting-started-guide/language-setup/language-switcher-options/adding-language-switchers-using-php-and-shortcodes/

September 14, 2023 at 6:09 pm #14399177

Swen Kleibrink

This is where it should include it so developers know to inform their customers of the themes
https://wpml.org/wpml-hook/wpml_add_language_selector/

it states "This action hook does not have any parameters." but that is wrong and it does not point you to what you pointed me to , so it displays as the user wishes 🙂

September 14, 2023 at 7:37 pm #14399501

Nicolas V.
Supporter

Languages: English (English ) French (Français )

Timezone: America/Lima (GMT-05:00)

Good observation. I opened a ticket with the documentation team to specify which language switcher:

Displays the drop down language selector as configured from the “WPML->Languages->Custom Language Switchers” admin screen