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.

Tagged: 

This topic contains 0 replies, has 0 voices.

Last updated by Jeffrey Edison 18 hours, 52 minutes ago.

Assisted by: Itamar.

Author Posts
March 16, 2025 at 4:37 pm #16821989

Jeffrey Edison

Background of the issue:
- I have a number of ACF fields, among which a repeater field (sidebar_item).
- The repeater field is set to 'Different fields across languages'.
- I am using the WP Translation Editor (not WPML Advanced Translation Editor) to manage external translations.
- The repeater field and content appear fine in WP Admin on the original (English) and translation pages (RU and UZ).
- The theme includes them in the sidebar on pages under 'Services' (or similar pages in RU and UZ), but they always appear in English.

I have spent quite some time researching what could go wrong between WPML and ACF (ACFML 2.1.5), but cannot find a solution.
I have tried changing ACF to indicate that the sidebar item (sidebar_item) is the same across all languages. No difference.
I have tried changing ACF to indicate that the sidebar item (sidebar_item) to expert mode. No difference.
I have tried a few variations of the_sub_field that are recommended on posts on Stackoverflow, such as with 'option' as a second parameter, with false or true as a second parameter, with 'iventure-uz' (the theme name) as a second parameter, but none of these help.

Symptoms:
The two sidebar contents on translated pages always appears in English instead of the respective language.
hidden link
hidden link
hidden link

Questions:
Why does the sidebar content always appear in English on translated pages?
How can I ensure the sidebar content is displayed in the correct language on the front end?

March 16, 2025 at 4:50 pm #16822061

Itamar
Supporter

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

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

Hi,

This ticket has been inactive for quite a while. I didn't get a reply from you. So, I've transformed this chat into a support ticket because you may still need our help. If you do, please reply to this ticket, and one of our supporters will continue helping you.

Is htis the sidebar with the problem?
Please see the attached screenshot.

If you need further help with this, please share the access details to your site with me. I'm enabling a private message for the following reply.
Privacy and Security Policy
We have strict policies regarding privacy and access to your information. Please see:
https://wpml.org/purchase/support-policy/privacy-and-security-when-providing-debug-information-for-support/
**IMPORTANT**
- - Please backup the site files and database before providing us access. --
-- If you have a staging site where the problem can be reproduced, it is better to share access to the staging site.--

Regards,
Itamar.

2025-03-16_18-45-41.jpg
March 16, 2025 at 5:02 pm #16822093

Jeffrey Edison

Yes, those are the sidebars with the problem

March 16, 2025 at 5:38 pm #16822163

Itamar
Supporter

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

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

Hi, and thanks for the access details.

In the begining you shared the code which created the sidebar. FOr some reason I cann ot see it anymore in this ticket.

Can you please share with me the code again?
Also please tell me which field group is this problem with?

Thanks,
Itamar.

March 17, 2025 at 12:38 pm #16824590

Jeffrey Edison

Here is the code
<?php if( have_rows('sidebar_item',28) ): while ( have_rows('sidebar_item',28) ) : the_row(); ?>
<div class="colBox">
<div class="wrapper">
<?php the_sub_field('box_content'); ?> <!-- ALWAYS INCLUDES IN ENGLISH -->
</div>
</div>
<?php endwhile; else :
echo('<p>');
_e( 'No content found!', 'iventure-uz' );
echo('</p>');
endif;
?>

March 17, 2025 at 12:39 pm #16824593

Jeffrey Edison

The ACF field group is called: Sidebar box (sidebar_item)

March 18, 2025 at 9:45 am #16828909

Itamar
Supporter

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

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

Hi,

Thanks for adding this information.

Are you sure everything is all right with the Sidebar box field group?
I see many things that you need to check and correct.

1. The Sidebar box field group does not have any sub-fields. Only the main parent repeater field (sidebar_item).

2. The field group is assigned to the hidden link">Services page. But you told me that the problem is on the hidden link">Accounting page.

For points 1 and 2, Please see the attached screenshot sidebar-box-group.jpg.

3. Repeater fields are added with the ACF Pro plugin. However, you are not using the Pro plugin. Please see the attached screenshot no-acf-pro.jpg. You have installed the Advanced Custom Fields: Repeater Field plugin, a very old plugin by the original author of ACF. This plugin is not supported anymore. You can see a reference for this here.

hidden link

The Repeater Field add-on is available within ACF PRO. It is no longer available as a plugin.

To correct this issue, follow these steps.

1. Install the ACF Pro plugin.
2. Correct the Sidebar box field group to include the sub-fields.
3. Assign it to the right page: hidden link">Accounting
4. Update the original page and its translations.

Also, please ensure to follow our ACF guide here (main guide).
https://wpml.org/documentation/related-projects/translate-sites-built-with-acf/

Regards,
Itamar.

sidebar-box-group.jpg
no-acf-pro.jpg
March 20, 2025 at 11:50 am #16839805

Jeffrey Edison

Hi,

Thanks - I did not see your response previously, but have now turned on email updates for responses.

1) The sidebar_item automatically has a sub-field "box_cotent" which you can see on the Services page and its translations to maintain the value.
Of course, I can add an explicit sub-field box_content, but that seems to already be working.
2) The field group is maintained in the parent page "Services" (post ID 28), but displayed in all of the subpages: Accounting, Specialty Services, Entering the US Market -
<?php if( have_rows('sidebar_item',28) ): while ( have_rows('sidebar_item',28) ) : the_row(); ?>
It does this correctly in English (hidden link, hidden link, hidden link)
3) Unfortunately, I am just the support person for this website - I will have to check with my client if they are willing to pay $100/year for repeater fields.
I may have to rewrite that code so that it explicitly uses sidebar_item_1 and sidebar_item_2 - not as elegant a solution, but it's free (other than my time).

Recommended steps:
1) I will check if the client accepts ACF Pro
2) Sidebar box already works in English, so I don't think that this is required
3) have_rows for ('sidebar_item', 28) gives the 2 sidebar_items for Services.
4) The original page is working fine and the translations are already present... they simply don't show.
I suspect that this is due to the old ACF Repeater Field plug-in not working correctly with WMPL.

I have followed the steps on the ACF/WPML guide.

March 23, 2025 at 12:22 pm #16848560

Itamar
Supporter

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

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

Hi,

Thanks for your detailed explanation.

You have a custom solution that we can't support at this point. In general, supporting custom code is out of the scope of our support forum. However, we try our best to help with custom code when a client presents it and explains what they expect to get. However, in your case, the old Advanced Custom Fields: Repeater Field plugin is not even supported by the authors of ACF, so naturally, it is also not supported by WPML. I can only consult our second-tier supporters about your code if things do not work when you use the ACF Pro plug, the plugin that is officially compatible with WPML. If you want, I can create a sandbox site for you to test things with ACF + Pro + WPML.

Regards,
Itamar.

March 23, 2025 at 12:58 pm #16848623

Jeffrey Edison

Thanks, it seems like the problem was this:

So an inelegant solution was to check which language was active and get the correct post ID:

elseif( get_language_shortcode() === 'ru' && have_rows('sidebar_item',9345) ): while ( have_rows('sidebar_item',9345) ) : the_row(); ?>
elseif( get_language_shortcode() === 'uz' && have_rows('sidebar_item',9344) ): while ( have_rows('sidebar_item',9344) ) : the_row(); ?>
Of course, this only works for a small number of non-changing language translations, but it suits our needs for the moment with no cost.