V
V
Vasily Penkevich2018-11-08 14:10:53
CMS
Vasily Penkevich, 2018-11-08 14:10:53

Hide individual WPML language switchers?

Good afternoon, dear users of the project "Toaster". There is a site on WordPress with the WPML plugin installed and actually here.
The question has arisen: how can you hide another specific country from the menu of a certain country.
For example, the English version, there is a menu. It has Russian, French languages. It is necessary that French is not visible only on the English version. And in the French version, the icon should not be displayed switching with English, only Russian and actually French itself. I've looked all over the settings and found nothing.
Thank you in advance for your help.

Answer the question

In order to leave comments, you need to log in

1 answer(s)
O
Orkhan Hasanli, 2018-11-08
@azerphoenix

Hello!
You know, I have not seen such functionality in this plugin. It has the ability to disable the selected specific language on the entire site.
But once I needed to do something similar and I implemented it with css + php.
In short, in the footer of the site you need to add the following code:

<?php if(ICL_LANGUAGE_CODE=='ru'): ?>
<!-- пример css кода -->
<style>
.sw-lang ul li:last-child {
    display: none;
}
</style>

<?php elseif(ICL_LANGUAGE_CODE=='en'): ?>
<!-- пример css кода -->
<style>
.sw-lang ul li:first-child {
    display: none;
}
</style>

<?php endif; ?>

True, on the site I have a custom switcher. The bottom line is that with the help of PHP we determine the language of the page on which we are. Accordingly, for another language, we hide the switch using pseudo-classes first-child last-child nth-child
. This, of course, is not the best solution, but it still works.

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question