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

Last updated by ericaG 12 months ago.

Assigned support staff: Diego Pereira.

Author Posts
October 15, 2018 at 2:50 am #2816083

ericaG

I am trying to: have 1 original language (italian) 1 full translated language (english) 20 translated languages only for homepage/one page site NOTE: with woocommerce products and porfolio post set with Translatable - use translation if available or fallback to default language pre 1st translated language (english)

Link to a page where the issue can be seen:

I expected to see:
language swicher only for italian/english in all page except homepage
language swicher of 22 languages in homepage

Instead, I got:
for pages set to Translatable - use translation if available or fallback to default language in 1st translated languages i see also the languages switch on all the other languages.

it is possible to set:
1st translated language products pages and portfolio to Translatable - use translation if available or fallback to default language
and for all other languages to Translatable - only show translated items

hope the question is clear.
Thanks!

October 16, 2018 at 2:22 pm #2821386

Diego Pereira
Supporter

Languages: English (English ) Spanish (Español ) Portuguese (Brazil) (Português )

Timezone: America/Sao_Paulo (GMT-03:00)

Hello @ericag, welcome to the WPML support Forum!

Are you using the language switcher that is generated through WPML > Languages > Language Switcher? - https://wpml.org/documentation/getting-started-guide/language-setup/language-switcher-options/

If so, please go to WPML > Languages > Language switcher options > How to handle languages without translation and check if it's set as "Skip language". Usually it only displays the flag if there is a translation of the page available to that language.

Please let me know if it worked for you.

All the best,
Diego

October 18, 2018 at 12:38 pm #2827933

ericaG

Hi Diego,
I see. But my question is a bit different from the option in the link you give me.
Sorry not to explain well before.
So I try again to explain what I'm trying to do.
I have a website: hidden link
with about 3.000 url. Original language in italian.
I translated it all in english, with another 3.000 pages in english at the end.
This is (amost) fix and working.

Then
I want to have ONLY the homepage translated in 20 more languages. Only the homepage.
With different content from the italian and english one.

This will be a 'one page website'.
in this page I have dinamic content generated by post preview and portfolio preview (widget showing only the picture of the post/portfolio) so that every time I add a post (in italian) also if i not translate it, its pictures will show up in the homepage of the french/spanish/portuguese....

In order to have this content I've setted the options like explained here
https://wpml.org/documentation/translating-your-contents/displaying-untranslated-content-on-pages-in-secondary-languages/
because english is all transalted so it will be visible in english,
and the other languages it is ok to have it to copy because I only need the picture for the homepage widget.

so all this seems fix and working for me.

the problem now is that if I go in any post/portfolio/product page, I also see the french/spanish/portuguese switcher.
But I don't want the user to be able to open these pages in languages other than italian and english (because these are the only translated pages.

So I need to disable the switcher for these languages french/spanish/portuguese... in all the pages except homepage.
plus
I need to make the preview of posts/portfolios/products not clickable
and this pages noindex as well
Can this be done?
thanks for your help!

October 18, 2018 at 9:04 pm #2829643

Diego Pereira
Supporter

Languages: English (English ) Spanish (Español ) Portuguese (Brazil) (Português )

Timezone: America/Sao_Paulo (GMT-03:00)

Hi there,

Please send us access to your WordPress dashboard (website URL, login and password), and the link of the pages. I'll check and do some tests. - Please use the private field to send the sensitive data - do not post if you do not see it.

It would be better if you give me a test site rather than the live site.

IMPORTANT Please backup a working copy of site files and database before.

Maybe I'll need to replicate your site locally. For this please install these plugins. They will allow me to create a copy of the website:
- Duplicator: https://wordpress.org/plugins/duplicator/
- Cloudways WordPress Migration: https://wordpress.org/plugins/bv-cloudways-automated-migration/

Once the problem is resolved I will delete the test site. Please let me know if this is ok for you.

To ensure the quickest and most accurate support, please provide your debug information so that I can get a look at some of your configurations. We have an excellent article on how to located here: https://wpml.org/faq/provide-debug-information-faster-support/.
NOTE: Please be sure to check the box to indicate you can provide debug info and paste your debug info in the debug field provided, and NOT in the general response field.

Regards,
Diego

October 19, 2018 at 3:22 pm #2832541

Diego Pereira
Supporter

Languages: English (English ) Spanish (Español ) Portuguese (Brazil) (Português )

Timezone: America/Sao_Paulo (GMT-03:00)

Hello Erica,

It's possible to hide the language switcher, and display it only on home, using CSS. Please go to Appearance > Customize > Addiitonal CSS and add the following snippet:

.wpml-ls-statics-footer, .menu-item-type-wpml_ls_menu_item {
  display: none !important;
}

body.home .wpml-ls-statics-footer, body.home .menu-item-type-wpml_ls_menu_item {
  display: block !important;
}

This way the language switcher will only be displayed on the home.

To make an element not clickable, you can add the "pointer-events: none;" CSS attribute. E.g.:

.your-element-class {
pointer-events: none;
}

You can use the YOAST plugin to add a "NOINDEX" to a page: hidden link

Here is our guide on how to use WPML with YOAST: https://wpml.org/documentation/plugins-compatibility/using-wordpress-seo-with-wpml/

If you need more help just let me know.

Kind regards,
Diego

October 21, 2018 at 10:38 pm #2836141

ericaG

Hello Diego,
your code is working perfectly!
But my fault, I was not clear before...
The italian and english flags should be available in all languages, only the language switcher other than this 2 should be hidden.
I've modified to
.wpml-ls-statics-footer, .menu-item-type-wpml_ls_menu_item {
display: none !important;
}

body.home .wpml-ls-statics-footer, body.home .menu-item-type-wpml_ls_menu_item, .wpml-ls-item-it, .wpml-ls-item-en{
display: block !important;
}
and it is working...! You think is correct?
thank you a lot!

October 22, 2018 at 1:17 pm #2838189

Diego Pereira
Supporter

Languages: English (English ) Spanish (Español ) Portuguese (Brazil) (Português )

Timezone: America/Sao_Paulo (GMT-03:00)

Hi there,

The code seems ok to me 🙂 If it's working on your website, I think everything is fine.

If you need more help just let us know.

Kind regards,
Diego

October 22, 2018 at 4:10 pm #2838877

ericaG

My issue is resolved now. Thank you!