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.

Sun Mon Tue Wed Thu Fri Sat
13:00 – 17:00 8:00 – 12:00 8:00 – 12:00 8:00 – 12:00 8:00 – 12:00 8:00 – 12:00 -
- 13:00 – 17:00 13:00 – 17:00 13:00 – 17:00 13:00 – 17:00 - -

Supporter timezone: Asia/Jerusalem (GMT+03:00)

This topic contains 9 replies, has 2 voices.

Last updated by Eran Helzer 1 year, 8 months ago.

Assisted by: Eran Helzer.

Author Posts
July 27, 2023 at 7:11 pm #14113305

wei-chunT

I'm translating pages including custom post types.

Take this page as an example;
hidden link
In English version, the field "Nearest MRT" shows, but not the Chinese version.

I followed the documentation on
https://wpml.org/errata/advanced-custom-fields-field-group-should-be-set-as-not-translatable/
and made sure the custom field group is not translatable.

I have a second question, on the page
hidden link
The page listings does not show up the Chinese version.

Thanks in advance.

July 28, 2023 at 8:16 am #14115381

Eran Helzer
Supporter

Languages: English (English ) Hebrew (עברית )

Timezone: Asia/Jerusalem (GMT+03:00)

Hi,

Regarding the first issue, can you please explain to me how the field is added to the English version?
If you can add screenshots and/or a recording showing this and how you translate the content of the field that would also help me.

Also, from the debug information you supplied I can see that the WordPress memory limit is set to 40MB. You should increase this to 128MB, as that is the minimum requirement for using WPML in the best way.
You can see how to do that here:
https://wpml.org/home/minimum-requirements/
https://wpml.org/faq/checklist-before-opening-a-ticket-in-wpml-support/#how-to-increase-your-sites-memory-limit

Regarding the second question, are you sure the page is translated to Chinese correctly? If it isn't, the language switcher will not show.

Please update me with this additional information.

July 31, 2023 at 3:55 am #14123561

wei-chunT

I just realised my reply to the email wasn't posted here.

Hi Eran,

I've made the a video recording for my reply.
Here's the link:-
hidden link

Looking forward to your reply. Thanks.

July 31, 2023 at 6:49 am #14124257

Eran Helzer
Supporter

Languages: English (English ) Hebrew (עברית )

Timezone: Asia/Jerusalem (GMT+03:00)

Okay, thanks for the recording.

Let me answer your questions first, then address the issue.
1 - The WPML -> Settings -> Custom Fields Translation lock icon:
ACF Multilingual enables you to configure the translation preference ("Don't translate", "Copy", "Copy once", "Translate"), for each custom fields. You can do that by manually setting the translation preference for each field you create, or by setting a "translation option" for the field group. The translation option will configure the translation preference for each field in the group, according to the type of the field.
In your case, you have "Same fields across languages" selected in the "Visit Option" field group. Thus, it is using the preconfigured translation preference for each field, and if you want to be able to manually set it you need to change the translation option to "Expert".
https://wpml.org/documentation/related-projects/translate-sites-built-with-acf/recommended-custom-fields-translation-preferences-for-acf-and-wpml/

2 - In the same field group, on the bottom of the page there is a "Multilingual Content Setup" section. That is related to translating field titles and labels, but you do not need to change it (leave it as "Do not make "Field Groups" translatable").
Please take a look at our documentation here:
https://wpml.org/documentation/related-projects/translate-sites-built-with-acf/expert-translation-option/#field-group-translation-settings

Now, regarding the issues:
1 - The missing "Visit More" articles":
Yes, this is probably related to the WPML -> Settings -> Post Types Translation setting. Please try setting it to "Translatable - use translation if available or fallback to default language"

2 - Missing field from frontend:
Here, I believe the reason is that the page is not translated fully, thus not updating the actual translation on your site. WPML's Advanced Translation Editor will save in-progress translations, so you can start, take a break, and finish them without losing translations, but it won't save them until you complete the translation. Please try to finish the entire translation, then check if the field appears

August 2, 2023 at 8:57 am #14140089
wei-chunT

Hi Eran,

Here's my follow up questions, and question you missed in my last post:-
1. Custom post field label translation
2. Custom post page doesn't show any translated post items after switching language,
3. Duplicate posts -> in the original language (eng), the eng and chi posts both shows.
4. Font size for translated language.

See the video for the info:-
hidden link

Looking forward to your reply.

New threads created by Eran Helzer and linked to this one are listed below:

https://wpml.org/forums/topic/font-size-for-some-pages-is-not-correct/

August 2, 2023 at 10:54 am #14141469

Eran Helzer
Supporter

Languages: English (English ) Hebrew (עברית )

Timezone: Asia/Jerusalem (GMT+03:00)

Okay.

1. Using WPML -> String Translation, no additional configuration needed
https://wpml.org/documentation/related-projects/translate-sites-built-with-acf/#translating-labels
2. + 3. I see that the posts are loaded with an ajax request. Make sure that the WPML -> Languages -> Language filtering for AJAX operations is checked
4. Again, hard to say without more information

Please make sure to have a working backup of your site before proceeding.
After you implement the suggested solutions, I would like to take a look and see if I can the spot the reason for the font issue, and the ajax if this doesn't resolve it.

I have set your next reply to be private so you can share credentials there.
Remember that it is always better to create a new admin user for me, then when we are done you can delete it.

August 4, 2023 at 1:00 pm #14155059

Eran Helzer
Supporter

Languages: English (English ) Hebrew (עברית )

Timezone: Asia/Jerusalem (GMT+03:00)

Okay, some updates.

1. After looking at how Visits are configured and created, I understood that the fields on the frontend are not the ACF fields. For example, "Address" is a combination of "Address Street Name" "Address Country" and "Address Postal Code".

Thus, I concluded that the "Address" string is coming from the theme itself.
I tried to use the FTP credentials you provided to take a look at the theme files, but it didn't work. I installed the "File Manager" plugin instead.

What I saw is that the field titles themselves were not registered for translation. I edited the file to register the "Address" string.
From:

$field_html = field_to_html_info($field_v, "Address", "");

To:

$field_html = field_to_html_info($field_v, __("Address", "divi-child"), "");

Then, I rescanned the theme using WPML -> Theme and plugins localization, translated the text using String Translation, and now the Chinese version is translated ("Address CH")
Please take a look:
hidden link

What you need to do is the same for the rest of the field titles, rescan the theme and translated them.

2. + 3. Here I looked at your function-ajax.php. It looks like you are not filtering based on language at all. Since this is custom code, you need to do the post language filtering yourself. One way I can think of is filtering the posts using the "wpml_post_language_details" along with the "wpml_current_language" hooks. Please take a look at our documentation here on how to use it:
https://wpml.org/wpml-hook/wpml_post_language_details/
https://wpml.org/wpml-hook/wpml_current_language/
I will also ask the 2nd tier and confirm this for you.

4. Let's handle the others first, then get to this

I now understand that the issues are coming from custom code. This is outside of our support policy, so we can not take responsibility for any of the code or the suggested solutions. I will, of course, do my best to help, but please take this into account.

I will get back to you on points 2 and 3.

August 7, 2023 at 11:16 am #14163115

Eran Helzer
Supporter

Languages: English (English ) Hebrew (עברית )

Timezone: Asia/Jerusalem (GMT+03:00)

One more update.

The 2nd tier have replied to about 2. and 3. Please try to add this argument to the get_posts call in the function-ajax.php file:

'suppress_filters' => false

This should make the request filter posts by the current language.

August 7, 2023 at 12:54 pm #14163899

wei-chunT

Hi Eran,

I'm should be able to fix the issue 1 (post type field labels) now from what you mentioned.

The code you suggested
'suppress_filters' => false
fix the number 3 issue (duplicate; both eng and chi version shown on the original language)

but the code doesn't solve issue 2 - Custom post page doesn't show any translated post items after switching language.

Any suggestion?

August 7, 2023 at 3:04 pm #14164795

Eran Helzer
Supporter

Languages: English (English ) Hebrew (עברית )

Timezone: Asia/Jerusalem (GMT+03:00)

Great, happy to hear that some issues are solved.

Regarding 2, now it is a matter of debugging. With the "suppress_filters" the language filtering should have solved this.

I suggest you debug this, somewhere in the request an argument is being provided that causes none of the posts to return. I would suggest you go by elimination, removing arguments from the get_posts call until something is returned, then you'll know what the problematic filter was.

Regarding issue 4, I would prefer to split it into a new ticket. It is our policy to keep it to one issue per ticket, that way everything is organized and clear.

The topic ‘[Closed] Some ACF field not showing in translated pages frontend’ is closed to new replies.