Repeatable field groups help you build advanced sites simply. More importantly, they make it easier to manage content without risking to break the front-end design.
A custom field lets you add one piece of information to a post, page or custom post type. A repeatable fields group lets you add lists of information. You can think of repeatable field groups as a table, containing rows for each of the items and columns for their different fields.
For example, here is a repeatable fields group, which we’ve set-up to display a gallery on the front-end.
In this example, the “gallery” is the list and each of the items in the gallery needs several pieces of information to display (an image, description and optional link).
When you use repeatable field groups, you completely separate between content editing and how the content appears on the front-end. Editors will use the table-structure in the WordPress admin, which shows the different fields for each item. The repeatable field group displays on the front-end using a template.
This produces a number of big advantages:
- Editors can add, modify and remove items without (you) worrying about breaking the site on the front-end.
- You can display the exact same information, or parts of it, in different ways.
- It’s much easier to translate. Your translators only edit the texts, without touching delicate designs.
WordPress doesn’t have repeatable field groups. However, there are plugins that will create them for you.
Repeatable field groups are also coming to Toolset (currently available in betas). Toolset comes from the same team that develops WPML, so everything you build with Toolset is multilingual-ready by design.
Repeatable field groups in Toolset and in ACF look very similar in the WordPress admin.
Here is how you would set-up a repeatable fields group in Toolset and use it to edit content:
Once you’ve created the repeatable field groups in the WordPress admin, you probably want to display them on the site’s front-end.
When you design how the repeatable fields group appears on the front-end, you create one template, which WordPress will use for all the repeatable items. There’s no need to duplicate your design for each item in the group.
ACF and Toolset take very different approaches to this as well.
ACF supplies a rich PHP API for adding fields to templates. You will need to edit the template that’s responsible for the post-type and call the functions that display the field groups. To do this, you need to have basic understanding in PHP and HTML. See the ‘Template Usage’ section in ACF’s Repeater Field page for examples.
Toolset also has a PHP API that you can use, but the big attraction in Toolset is that you can design templates without writing PHP. In Toolset, you’ll need to create a View that will display the repeatable fields group. You can add this View to any page or template.
Since you’re displaying the repeatable fields group with some code, you can design dynamic displays for it. For example, you can add filters, pagination and conditional logic.
Let’s say that our gallery example should include links to items, but they’re optional. When a gallery item has a destination URL, we’ll display a link. If we build it with ACF, we’ll write PHP code that checks that field and outputs the link conditionally. Toolset makes it a bit easier, by using conditional HTML shortcodes. This way, we can examine the values of fields in the group and display elements according to conditions.
And, if some pages include very large galleries, we can easily break them up into pages and allow visitors to switch pages using AJAX updates.
Both ACF and Toolset are compatible with WPML. For ACF, we’ve built a glue plugin called ACFME (ACF Multilingual). You can learn how to use it through the documentation on running multilingual sites with ACF.
Toolset is compatible with WPML “out of the box”, without additional glue plugins. We wrote a complete guide on translating Toolset sites with WPML. There’s also a short page that teaches how to translate repeatable field groups.
Since we’re displaying the repeatable field groups on the front-end dynamically, all we need is to translate their values. The output will get built “automatically”. It will show the originals if there’s no translation, or translated texts once we translate.