This thread is resolved. Here is a description of the problem and solution.
Problem:
If you're experiencing issues where repeater fields are not displayed when filled in a translated language on your site, this could be due to the setup of your translation configuration. Specifically, if a page is created in one language and then copied to another, with repeater fields added only in the translated version, these fields might not show up as expected.
Solution:
We recommend ensuring that you are using the ACFML addon and have set the field group mode to 'Different fields across languages'. It's crucial to use the
wpml_object_id
hook to retrieve the correct post ID in the translated language. Here’s a step-by-step guide on how to implement this:
<?php<br />$repeater_field = 'rep'; // Change this to your repeater field name<br />$text_sub_field = 'text'; // Change this to your text field inside the repeater<br />$translated_post_id = apply_filters('wpml_object_id', get_the_ID(), 'post');<br />if (have_rows($repeater_field, $translated_post_id)) {<br /> echo '<ul>'; // Start a list for better formatting<br /> while (have_rows($repeater_field, $translated_post_id)) {<br /> the_row();<br /> $text_value = get_sub_field($text_sub_field);<br /> if ($text_value) {<br /> echo '<li>' . esc_html($text_value) . '</li>';<br /> }<br /> }<br /> echo '</ul>'; // Close the list<br />} else {<br /> echo '<p>No data available.</p>';<br />}<br />?>
For more details on using the
wpml_object_id
hook, please visit https://wpml.org/wpml-hook/wpml_object_id/.
If this solution does not resolve your issue, or if it seems outdated or irrelevant to your specific case, 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. If further assistance is needed, please open a new support ticket at 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.
This topic contains 3 replies, has 0 voices.
Last updated by 1 month, 1 week ago.
Assisted by: Dražen.