ACF Pro Repeater fields are a powerful feature that allows you to create dynamic content on your WordPress website. This tutorial aims to guide you through the process of setting up and using Advanced Custom Fields Pro Repeater fields.
Prerequisites
Please make sure you have the following installed and activated:
- Advanced Custom Fields (Pro)
Setting Up the Repeater Field
Create a New Field Group
- Navigate to
Custom Fields > Field Groups
in your WordPress dashboard. - Click on
Add New
to create a new field group. - Name the field group. For example, “Job Details”.
Add the Repeater Field
- Scroll down to the
Fields
section. - Click on
Add Field
. - Choose “Repeater” from the field type dropdown or browse fields.
- Name the field, for example, “Job Details”.
Tip: You can also add repeater fields to existing field groups.
Configuring Subfields
Add Text Field for Company Name
- Navigate to
Subfields
under the repeater field. - Click on
Add Subfield
. - Select “Text” as the field type.
- Name the subfield “Company”.
Add WYSIWYG Field for Job Description
- Click on
Add Subfield
again. - Select “WYSIWYG” as the field type.
- Name the subfield “Job Description”.
Add Numeric Field for Salary
- Click on
Add Subfield
once more. - Select “Number” as the field type.
- Name the subfield “Salary”.
Tip: You can prepend or append text to the number. For example, prepend a currency symbol like “$”.
Using the Repeater Field
- Navigate to the custom post type where you’ve assigned the repeater field.
- Click on
Add New
. - Scroll down to the “Job Details” repeater field.
- Click on
Add Row
to add your first job. - Fill in the company name, job description, and salary.
- Click on
Add Row
again to add more jobs if needed.
Note: You can remove rows by hovering over the row and clicking
Remove
.
Additional Layout Options
ACF Pro offers different layout options for the repeater field:
- Table
Default layout. - Block
Stacks fields on top of each other. - Row
A different layout that’s easier to navigate.
To change the layout:
- Navigate back to your field group in
Custom Fields > Field Groups
. - Click on your repeater field to expand it.
- Select the layout you prefer from the
Layout
dropdown.
ACF Pro Repeater Fields Basics – Conclusion
Understanding how to use ACF Pro Repeater fields can greatly expand the dynamic content capabilities of your WordPress site. From creating job listings to complex layouts, the possibilities are endless.