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.

Sun Mon Tue Wed Thu Fri Sat
- 9:00 – 13:00 9:00 – 13:00 9:00 – 13:00 9:00 – 13:00 9:00 – 13:00 -
- 14:00 – 18:00 14:00 – 18:00 14:00 – 18:00 14:00 – 18:00 14:00 – 18:00 -

Supporter timezone: America/Los_Angeles (GMT-07:00)

This topic contains 5 replies, has 2 voices.

Last updated by Bobby 1 year, 11 months ago.

Assisted by: Bobby.

Author Posts
July 5, 2023 at 6:02 pm #13953331

dannyM-2

When using the WPML Language Switcher block it shows both the current language as the available other language. How to hide the current language and only show the other available language?

July 5, 2023 at 7:18 pm #13953589

Bobby
WPML Supporter since 04/2015

Languages: English (English )

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

Hello,

Please go to WPML->languages->edit the menu language switcher you are using and uncheck the option "current language"

Note: This is only available for "list of languages" type of menu and not a drop-down menu.

https://wpml.org/documentation/getting-started-guide/language-setup/language-switcher-options/

July 5, 2023 at 7:24 pm #13953593

dannyM-2

Dear Bobby,

Thank you for your quick reply. Unfortunately, this only works if you add the language switcher to a classical menu. I'm using the WPML Language Switcher block in Gutenberg and it shows both the current language as the other languages, despite in the settings unchecking the option "current language".

July 5, 2023 at 7:41 pm #13953699

Bobby
WPML Supporter since 04/2015

Languages: English (English )

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

I see, thank you for updating me!

In this case, I suggest using the shortcode instead to display the language switcher.

- Add a Guttenberg shortcode block
- Add "[wpml_language_selector_widget]" in the block and update
- Go to WPML->languages->enable custom language switcher and then edit it

see my screennshot where you can see the block switcher vs the shortcode one

Screen Shot 2023-07-05 at 12.39.37 PM.png
July 5, 2023 at 8:37 pm #13954045

dannyM-2

Thanks! I did as you instructed, however, I just want a simple plain link and the shortcode you gave me is adding some sort of box with different colors to my header. How do I just get a simple clickable "Nederlands" instead of the way it is being shown now?

Screenshot 2023-07-05 at 22.35.57.png
July 6, 2023 at 7:08 pm #13962895

Bobby
WPML Supporter since 04/2015

Languages: English (English )

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

The easiest way is by using some CSS to alter the standard widget css. Widgets will typically display that way.

You can use the following CSS

.wpml-ls-statics-shortcode_actions, .wpml-ls-statics-shortcode_actions .wpml-ls-sub-menu, .wpml-ls-statics-shortcode_actions a {
    border-color: #ffffff00;
}
.wpml-ls-statics-shortcode_actions {
    background-color: #ffffff00;
}

Another way is by adding a custom language switcher directly to the code in header.php
do_action('wpml_add_language_selector');
Documentation: https://wpml.org/documentation/getting-started-guide/language-setup/language-switcher-options/adding-language-switchers-using-php-and-shortcodes/

Custom Code Notice: Please note that we do not provide custom solutions in the forum and the above CSS is provided at the supporter's discretion. Please always have a backup in place before using any custom code provided by our team.

The topic ‘[Closed] Hide current language’ is closed to new replies.