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 5 replies, has 2 voices.

Last updated by pabloA-26 2 months ago.

Assigned support staff: Rajeeb Banstola.

Author Posts
July 22, 2019 at 5:30 pm #4260435

pabloA-26

Tell us what you are trying to do?

My site is translated in spanish, english, catalan, italian and portuguese

When my users are navigating in italian or portuguese then I want to be able to hide catalán from the language picker.

Is this something I could do with wpml?

July 22, 2019 at 10:43 pm #4261651

Rajeeb Banstola

Hi,

Thank you for contacting WPML!

There's no inbuilt option in WPML to hide language as per your requirement.
However, you can make a workaround with Custom CSS:

You can find the language code in HTML which you can use to target specific language and li item to hide the selected languages.

For example, you can target US English language with below code:

html:lang(en-US) li.wpml-ls-item-es {
    display: none;
}

This would hide the list item for Spanish language (es) when English language is active.

You can replicate the code to work with your requirement.

Let me know if you have any questions.

July 25, 2019 at 12:52 pm #4283281

pabloA-26

I have added the code you mentioned on style.css of my theme, however the language is still showing.

July 26, 2019 at 12:00 pm #4289531

pabloA-26

Tried doing this for spanish but's not working. What css would you say I have to edit? Or create a new one?

July 26, 2019 at 12:15 pm #4289597

Rajeeb Banstola

Hi,

That code is an example for how you can change things. You would have to change the language code in that code.

For example,
html:lang(en-US) - this part is targeting the current language, change it with the language code for italian, like html:lang(it-IT)
li.wpml-ls-item-es - this part dictates which HTML item to hide when the first language code in first part is active. es is the language code here. Thus, will hide any HTML item with class wpml-ls-item-es. You can hide the catalan language with changing wpml-ls-item-ca

Is it possible for you to provide your site link? I can give you the CSS that can accomplish what you want.

August 12, 2019 at 4:14 pm #4382251

pabloA-26

Hi there, I was able to put it into production, could you help me with the code? This is the site: hidden link