דלג על ניווט
0

Depending on the kind of website you have, you may find yourself working with repeating types of content. ACF’s Repeater fields allow you to create a group of fields and make them repeatable as many times as you need. Using WPML, you can easily turn it all multilingual.

In this tutorial, we’ll show you how to translate your ACF Repeater fields with WPML. 

As an example, here’s a post created using the Repeater field from Advanced Custom Fields. Our Repeater field is called Keynote Speakers and it has 6 sub fields:

  • An Image field for each person’s photo
  • A Text field for each person’s name
  • A Text Area field for a short biography
  • A Select field to display each person’s areas of expertise
  • A Repeater field to display keynotes
  • An Email field to display the contact information

A post created using the Repeater field in the default language

A post created using the Repeater field in the secondary language

What You Will Need

Before we begin, make sure you have the following plugins installed and activated on your site:

  • ACF PRO plugin
  • WPML core plugin (Multilingual CMS or Multilingual Agency) and the String Translation add-on
  • Advanced Custom Fields Multilingual glue plugin (you can find this add-on in the Downloads section of your WPML account)

If you’re a first time WPML user, you can learn how to set up and configure WPML by taking a look at our Getting Started Guide.

Getting Started with ACF Repeater Fields

As powerful as the free version of the Advanced Custom Fields plugin is, you get even more functionality with Advanced Custom Fields PRO. The premium version comes with advanced features like ACF blocks, page building tools, custom Options pages, and the Repeater field. All of these features can help you use Advanced Custom Fields in interesting ways, but we’ll focus solely on the Repeater field

The ACF Repeater field makes it easier to work with instances of similar custom content. Let’s say your website has a section dedicated to the members of your organization. You may find yourself inputting the same data for each staff member, such as:

  • Name
  • Image
  • Job Title 
  • Contact Information

With the Repeater field, you don’t have to create separate post types that are connected to a particular post or page. Once you create a main Repeater field, you can add a set of sub fields to it. The result – custom fields which can be repeated over and over again. 

Any type of field can be added as a sub field, which gives you the versatility to work with data customized to your needs. As the example below illustrates, you can add Text area fields dedicated to personal information like a short biography, or a Select field for hobbies.

An employee directory page displaying the Repeater field interface 

Because of how flexible Repeater fields are, you can use them to manage simple or complex groups of information on various types of websites. For example, you can use Repeater fields to manage product variations on an e-commerce site. Or, you can use them to display information about artists and showcase their art on your portfolio website.

Translating ACF Repeater Fields with WPML

Thanks to the ongoing compatibility efforts between Advanced Custom Fields and WPML, you can easily translate values in your Repeater’s sub fields with ACF Multilingual, our WPML 'glue' plugin.  

Setting the Translation Preferences

If you’ve set translation preferences for ACF custom fields in the past, you’ll find these steps familiar. You can set the translation preferences for your Repeater fields and sub fields in two places:

  1. By going to WPML Settings and scrolling down to the Custom Fields Translation section.
Setting the translation options for ACF repeater fields and sub fields from the WPML Settings page
  1. In the Translation preferences section you’ll see when creating fields or editing field settings in ACF.
Setting the translation options for an ACF field when creating or editing it

When you set up your Repeater fields, you’ll likely end up with a number of sub fields assigned to a main Repeater field. We recommend setting your main Repeater field to Copy or Copy once. Here’s how to decide which setting to use: 

  • If you’re looking to have the same number of fields and the same field values in all languages, set your Repeater field to Copy.
  • For a different number of fields and/or different field values across different languages, choose the Copy once option.

For your sub fields, you can choose from any of the four translation preferences:

  • Don’t translate 
  • Copy 
  • Copy Once
  • Translate  

Each of your sub fields can have different translation preferences. For example, you may want to set Text Area field types, like the Biography field to Translate. On the other hand, you may want to Copy the field values for field types like Email, Number, or Image.

Choosing a Translation Method

Advanced Custom Fields is fully compatible with WPML, which allows you to choose between two translation methods:

  • The Translate Everything mode automatically translates your content as you add or edit it. If you have the Translate Everything mode enabled, any of the sub fields you set to Translate will be automatically translated. You can also review the translations before publishing them to make sure they’re correct.
  • The Translate Some mode allows you to decide what to translate and who will translate it. You can choose from translating the content by yourself, sending it to a professional translator, or enlisting the help of a translation agency.

Translating Your Repeater Fields

For the purpose of this tutorial, we’ve created an event website with a post dedicated to keynote speakers. Our main Repeater field is called Keynote Speakers and it has six different types of fields added as Sub Fields assigned to it. 

An example of a Repeater field with multiple sub fields

One of our sub fields is called Keynotes and it is a nested Repeater. Essentially, it is a child Repeater within a parent Repeater. If you expand it, you can see that it has its own sub fields assigned to it. In our case, it displays information about past keynotes led by each of our keynote speakers. 

An example of a nested Repeater with sub fields

In our main parent Repeater, we’ve set our About and Areas of Expertise sub fields to Translate. The remaining fields are set to Copy.

Our child Repeater is set to Copy, and both the Title and Details sub fields are set to Translate.

Now, we’ll show you how to translate the content in your post and all of the field values set to Translate by yourself using the Translate Some mode:

  1. Go to your post in the default language.
  2. In the right sidebar, find the Language box and click the plus icon next to the language you want to translate your post into.
Clicking the plus icon to translate your post
  1. You’ll be taken to the Advanced Translation Editor page. The post content such as your title and body and the values of the sub fields set to Translate are available for translation. If you have translation credits, you can click on Translate automatically to add machine translations. If not, enter the translations for each line manually.
Translating the post in the Advanced Translation Editor
  1. Once you’ve completed all the translations and are happy with them, press the Complete button.

That’s it! In just a few simple steps, you’ve translated your ACF field values. 

You can now view your translations on the front-end. Please note that you'll need coding knowledge to display your ACF Repeater fields on the front-end

Wrapping Up

The Repeater field from ACF can come in handy, especially if you’re dealing with repeating instances of customized data. And with WPML and its ACF Multilingual add-on, it’s easier than ever to translate your repeater fields. All you need to do is set the right translation preferences, choose a translation mode, and translate your content. The glue plugin is also regularly updated, so you can rest assured knowing ACF and WPML work great together.

Do you have any questions about translating ACF Repeater fields with WPML? Feel free to let us know in the comments section!

How can we make WPML better for you?

Share your thoughts and comments about our plugin, documentation, or videos by booking a Zoom call with Agnes, our Client Advocate. Your feedback matters and helps us improve.

Book a call with Agnes