Sauter la navigation

Translating Repeatable Field Groups dans WordPress

Toolset allows you to create and display repeatable field groups. Here, we explain how to set correct translation options and translate repeatable field groups.

For instance, let’s say you have a repeatable field group for adding an image gallery to your website’s pages. Each repeatable group has its own image, caption, link (URL), and alt value. The following image shows how your repeatable field group appears when editing a page.

Repeatable fields group on the post editing screen

For each gallery item, there are multiple fields and you can add as many gallery items to your page as you like.

Let’s see how a repeatable field group can be made translatable.

Translation Settings for Repeatable Field Groups

To be able to translate a repeatable field group you need to set the following two translation settings.

1. Make the associated post type translatable

A repeatable field group is assigned to only one specific post type. In this example, the gallery is assigned to standard « Pages ».

You need to make a repeatable field group translatable. Go to the WPML → Settings page and scroll to the Post Types Translation section. There, select either of the two options to make the post type translatable.

Setting the translation option for the post type (i.e. Pages) associated with your repeatable field group

2. Set the translation options for the group’s fields

A repeatable field group is a set of regular custom fields. For each of these fields, you can select translation options, just as you can for any other custom fields on your website.

You can usually skip this step because Toolset and WPML will automatically set correct translation options for custom fields. If you need to select specific translation options for your custom fields, use the following steps.

Go to the WPML → Settings page and scroll to the Custom Fields Translation section. Here, select your preferred options for each field of the group.

Setting the translation options for each custom field belonging to your repeatable group

Alternatively, you can edit the custom fields group that hold your repeatable field group and set translation options for all fields there.

Translation options for fields of a repeatable group work the same as for other custom fields.

How to Translate Repeatable Field Groups

To translate contents of a repeatable field group, simply translate the post or a page that holds it. Again, you can translate such posts and pages directly or use WPML Translation Management to send them for translation.

Fields of a repeatable group in the Translation Editor