Skip to content Skip to sidebar

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

Problem:
The client wants the language switcher to only appear on the Malay language version of their website.
Solution:
If you're experiencing this, we recommend you use CSS to hide the language switcher from specific pages or languages. You can find detailed instructions on how to do this in our documentation on how to display or hide the language switcher on specific pages.

Specifically, you'll need to use the CSS :lang() Selector to target the menu item in the default language and hide it. You can find more information about the :lang() Selector here: MDN Web Docs.

Here is an example of the CSS code you could use:

.wpml-ls-menu-item:lang(en) {
    visibility: hidden !important;
}

If this solution doesn't look relevant to your situation, please open a new support ticket in the WPML support forum.

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 1 reply, has 2 voices.

Last updated by Mohamed Sayed 1 year, 6 months ago.

Assisted by: Mohamed Sayed.

Author Posts
January 18, 2024 at 9:32 am #15198874

dianahG

Another issue is I would like for the language switcher to temporarily only appear on my Malay language site, how do it do that?
This url : hidden link

January 18, 2024 at 10:13 am #15199086

Mohamed Sayed

Hi,

You can use CSS to hide the language switcher from specific pages/languages as described here: https://wpml.org/documentation/getting-started-guide/language-setup/language-switcher-options/how-to-display-or-hide-the-language-switcher-on-specific-pages/

In this case, you need to use the CSS :lang Selector to target the menu item in the default language and hide it. More info: hidden link

You can try something like this:

.wpml-ls-menu-item:lang(en) {
    visibility: hidden !important;
}

Kind regards,
Mohamed