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:
Hide a language when navigation in another specific language
Solution:

:lang(es-ES) .wpml-ls-item-ca {
    display: none !important;
}

I've added this CSS and it is following this syntax:
https://www.w3schools.com/cssref/sel_lang.asp

So basically it is about the following:
- Open Google Chrome console log
- check the HTML Lang language code
- create CSS as the above
- target only language menu item which has the language prefix in the CSS code which you want to hide - Catalan has "ca", meaning it is this one: .wpml-ls-item-ca

Make sure to add this CSS our where it will they picked up properly. You could also try adding it at the following location:
- WPML -> languages -> Language switcher options -> additional CSS

This topic contains 4 replies, has 2 voices.

Last updated by pabloA-26 1 month, 3 weeks ago.

Assigned support staff: Bruno Kos.

Author Posts
August 23, 2019 at 6:57 am #4444577

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?

This is my site. I currently have hidden italian and portuguese but we can test with catalan.

hidden link

August 23, 2019 at 7:27 am #4444843

Bruno Kos
Supporter

Languages: English (English )

Timezone: Europe/Zagreb (GMT+02:00)

Hi,

I moved this into professional support ticket since there was no response in chat.

I'm not sure this is possible, apart from perhaps coding custom language switcher by using "ICL_LANGUAGE_CODE" maybe, based on which page you are and in which language.
https://wpml.org/documentation/getting-started-guide/language-setup/custom-language-switcher/

If unsure how to do it, I suggest you seek help from our contractors:
https://wpml.org/contractors/

Because coding this and testing would be outside of the scope of support.

Regards,
Bruno Kos

August 23, 2019 at 7:56 am #4444905

pabloA-26

Sorry I didn't realice I was on chat.

It seems it is possible, as this previous thread: https://wpml.org/forums/topic/hide-a-language-when-navigation-in-another-specific-language/#post-4283281

But i was unfortunately closed as I forgot to check back

August 23, 2019 at 8:19 am #4445095

Bruno Kos
Supporter

Languages: English (English )

Timezone: Europe/Zagreb (GMT+02:00)

Hi,

Sorry about this, this idea Rajeeb suggested didn't cross my mind, but it definitely seems to be working.

I've tried this on your site directly - let me show you how:

:lang(es-ES) .wpml-ls-item-ca {
    display: none !important;
}

I've added this CSS and it is following this syntax:
hidden link

So basically it is about the following:
- Open Google Chrome console log
- check the HTML Lang language code
- create CSS as the above
- target only language menu item which has the language prefix in the CSS code which you want to hide - Catalan has "ca", meaning it is this one: .wpml-ls-item-ca

Make sure to add this CSS our where it will they picked up properly. You could also try adding it at the following location:
- WPML -> languages -> Language switcher options -> additional CSS

Regards,
Bruno Kos

August 23, 2019 at 1:30 pm #4447611

pabloA-26

Thanks a lot Bruno it worked perfectly using the additional CSS option in WPML config.