Skip Navigation

This thread is resolved. Here is a description of the problem and solution.

Problem:
The client needed guidance on how to disable automatic translation for specific fields like the title and description in a job listing, and also inquired about the implications of setting a custom post type job_listing to "Translatable - use translation if available or fallback to default language" versus "Translatable - only show translated items".
Solution:
To exclude the post title from the translation editor, we recommended following the workaround provided in this forum post. However, this involves custom code, and if the client is not comfortable implementing it, we suggested contacting one of our certified partners, which can be found here: WPML certified partners.
Regarding the translation settings, using the fallback setting "Translatable - use translation if available or fallback to default language" will disable the automatic translation feature. This feature only works with the setting "Translatable - only show translated items", which also means that a job added in a secondary language won't appear in the job list when switching back to the default language, nor will the language switcher show other languages.

If this solution does not apply to your case, or if it seems outdated, we highly recommend checking related known issues at https://wpml.org/known-issues/, verifying the version of the permanent fix, and confirming that you have installed the latest versions of themes and plugins. Should you need further assistance, please do not hesitate to open a new support ticket or visit our support forum.

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.

Tagged: 

This topic contains 7 replies, has 2 voices.

Last updated by Long Nguyen 5 months, 1 week ago.

Assisted by: Long Nguyen.

Author Posts
May 30, 2024 at 2:57 am #15685743

ericH-23

Hi,

2) how can I disable with automatically translation of jobs the translation of the fields which are filled in by users as for example the title and the description of a job?

May 30, 2024 at 3:04 am #15685745

Long Nguyen
Supporter

Languages: English (English )

Timezone: Asia/Ho_Chi_Minh (GMT+07:00)

Hi,

The sandbox site was expired, can you please reinstall the plugin on a new sandbox site so I can check the field again?
hidden link

Looking forward to your reply.
Thanks

May 31, 2024 at 10:04 am #15691574

ericH-23

Hi,
Thanks, automatically translation of the custom type "job_listings" is working, but title and description is translated also at the moment.
I found this from WPML and added the custom post type to it:
"add_filter( 'icl_job_elements', 'job_filter_title', 10, 2 );
function job_filter_title( $fields, $post_id ) {
global $post;
if ($post->post_type == "job_listing") {
foreach ($fields as $field => $value){
if ($value->field_type == "title") {
$value->field_translate = 0;
$value->field_data_translated = $value->field_data;
}
}
return $fields;
}}

add_filter( 'icl_job_elements', 'job_filter_the_content', 10, 2 );
function job_filter_the_content( $fields, $post_id ) {
global $post;
if ($post->post_type == "job_listing") {
foreach ($fields as $field => $value){
if ($value->field_type == "the_content") {
$value->field_translate = 0;
$value->field_data_translated = $value->field_data;
}
}
return $fields;
}}"
Can you check this please? Is this the right way?
In my further automatically translations I will see if this works.
Thanks, kind regards

May 31, 2024 at 11:22 am #15691882

ericH-23

Hi,
Result: nothing is translated, but now no content and no title is shown, also no slug is translated. So this is not working.
What can I do?
Shall I do the other way: set custom type job_listing to ""Translatable - use translation if available or fallback to default language"? By this the title and the content is not translated as all other things, but the taxonomies are shown in the current language, right? May be this is the better way. What is the procedure you recommend?
What I see further: if a user is in DE (EN is standard) and adds a job, this job is not seen in the job list if you switch to EN and the job page cannot be swithced into another language, the language switcher don't shows the other languages.
Thanks, kind regards

June 3, 2024 at 1:32 am #15696024

Long Nguyen
Supporter

Languages: English (English )

Timezone: Asia/Ho_Chi_Minh (GMT+07:00)

Hi,

You can follow the workaround in this ticket to remove the post title from the translation editor https://wpml.org/forums/topic/remove-title-from-translation-only-for-custom-post-type/#post-15269091

Note: this is a custom code, I would like to inform you that helping you with custom code, is out of the scope of WPML.
If you are not able to accomplish this, I would recommend you contact one of our certified partners who will be more than happy to help you with this. In this link, you will find a list of our certified partners: https://wpml.org/contractors/

Shall I do the other way: set custom type job_listing to "Translatable - use translation if available or fallback to default language"?

If you use the fallback setting, you cannot use the automatic translation feature as in this ticket https://wpml.org/forums/topic/how-can-i-set-only-new-old-jobs-translated-automatically/
The automatic translation feature only works with the setting "Translatable - only show translated items".

if a user is in DE (EN is standard) and adds a job, this job is not seen in the job list if you switch to EN and the job page cannot be switched into another language, the language switcher don't shows the other languages.

It is expected when you use the translation setting "Translatable - only show translated items".

Thanks.

June 3, 2024 at 11:18 am #15697605
ericH-23

Hi,
Thanks for the answer.
I have now following situation:
Standard language is EN
Added the code for disabling translation of the title
1) job_listing = Translatable, use translation if available or fallback to default language
a) user adds a job in EN
- no translation is done
- job is seen with all languages
- job type is shown in English in other languages, in spite this taxonomy is translated
b) user adds a job in DE
- no translation is done
- job is only seen in DE
2) now switching job_listing = Translatable, only show translated items
a) user added job in EN
- is translated
- job seen in all languages
- job type is translated
b) user addes job in DE
- is not translated
- job is only seen in DE
Additional info: the DE job is also hidden in other languages in the user listings, thats bad also

So my main question at the moment is: how can I have the DE job seen in all languages?

Thanks, kind regards

New threads created by Long Nguyen and linked to this one are listed below:

https://wpml.org/forums/topic/how-can-i-have-the-de-job-seen-in-all-languages/

June 3, 2024 at 11:23 am #15697608

ericH-23

Hi,
A further problem / info:
The translated job is seen in the buddyboss activities 4 times, for every language once. That I don't want. So the best way would be, to set the job_listing to Translatable, use translation if available or fallback to default language, so that this not occur anymore. And as you wrote, the DE job should be seen by this way also in other language. But at the moment it isn't.

June 4, 2024 at 2:05 am #15699574

Long Nguyen
Supporter

Languages: English (English )

Timezone: Asia/Ho_Chi_Minh (GMT+07:00)

Hi,

As I mentioned earlier, we limit one issue per ticket only. So I will split your new questions into new tickets for better handling and keep the ticket clean.

Thanks.