Skip Navigation

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.

Our next available supporter will start replying to tickets in about 7.05 hours from now. Thank you for your understanding.

This topic contains 5 replies, has 3 voices.

Last updated by Bobby 3 years, 5 months ago.

Assisted by: Bobby.

Author Posts
October 29, 2020 at 3:52 am #7331219

ashf

I'd like to show Menu Language Switcher on posts that's a non-translatable post type.

October 29, 2020 at 7:51 am #7331955

Laura
Supporter

Languages: English (English ) Italian (Italiano )

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

Hi,

thanks for contacting us.

Before your ticket is assigned to one of my colleagues, please allow me to walk you through some initial debugging steps. This will help speed up the support process.

It's not possible to show a language switcher for non-translatable content.
You may need to use custom code, but we cannot support it. You could consider asking one of our contractors https://wpml.org/contractors/

November 5, 2020 at 3:16 am #7381575

ashf

Another question.
Is it possible to check if language switcher is shown in a PHP function?

November 5, 2020 at 6:24 am #7382627

Bobby
Supporter

Languages: English (English )

Timezone: America/Los_Angeles (GMT-07:00)

Hi There,

You can showcase the language switcher however it will just redirect back to the homepage for any content that is missing translation.

Go to WPML->Languages-> Language switcher options -> Link to home of language for missing translations

Let me know your results, please.

NOTE: I am not sure what you mean by " check if language switcher is shown in a PHP function"

November 5, 2020 at 6:32 am #7382663

ashf

That option won't work with non-translatable post type I believe.

I'd like to do something like this to output language switcher conditionally when the page is not translatable.
(I use custom php template to output different content from single post data.)

if(ls_is_shown()){
/* output my language switcher */
}
or
if(LS_IS_SHOWN==true){
/* output my language switcher */
}

November 5, 2020 at 6:54 am #7382705

Bobby
Supporter

Languages: English (English )

Timezone: America/Los_Angeles (GMT-07:00)

It should work, I have test it with Posts set to "not translatable" in my environment.

Please test and let me know your results.

I recommend reviewing our WPML Hooks and Coding API for any custom work as it can help you achieve the desired behavior

https://wpml.org/documentation/support/wpml-coding-api/

https://wpml.org/documentation/support/wpml-coding-api/

This ticket is now closed. If you're a WPML client and need related help, please open a new support ticket.