Using Advanced Custom Fields: Repeater

Advanced Custom Fields is a plugin that can be used for WordPress development

Advanced Custom Fields, believe it or not, has several addons that you can install to improve ACF’s functionality. Today, let’s take a look at the Repeater premium addon for Advanced Custom Fields. Advanced Custom Fields: Repeater was written by Elliot Condon and costs $25 AUD.

You can take a look at the different addons available here. Click here to take read some more about the Repeater Addon.

Addons available for Advanced Custom Fields

Step 1: Buy and Install

The first step, if you would like to use Repeater fields, is to purchase the plugin and install/activate it on your WordPress site:

You should check if you the plugin is installed.

Step 2: Creating the Field

The next step is to create a custom field. You can do this by clicking on the Custom Fields item found in the admin bar:

The Advanced Custom Fields plugin menu bar

You should now be able to see this screen. Click on the Add New button to create a new Field Group:

The next step is to Click on 'Add New' button to create a new field group

Make sure that the Repeater Field Type is selected! Here’s an example:

You will need to add a new field

As you can see in the image below, Repeater is, without a doubt, a powerful addon. You can set a limit on the number or rows with the “Minimum Rows” and “Maximum Rows” fields. The Button Label field allows you to change the label of the ‘Add Row’ button.

repeateroptions

Now all you have to do is click on the publish button, found on the right side:

Click on the publish button to save your field.

Step 3: Adding the code

You will need to add the following code in single.php or page.php file.

<?php
 
// check if the repeater field has rows of data
if( have_rows('repeater_field') ):
 
 	// loop through the rows of data
    while ( have_rows('repeater_field') ) : the_row();
 
        // display a sub field value
        the_sub_field('sub_field_name');
 
    endwhile;
 
else :
 
    // no rows found
 
endif;
 
?>

Step 4: In Your Post Editor

You should now be able to see the repeater field in your post editor, like this:

You can add more fields while in your post editor

Just click on the ‘Add Row’ button to keep adding fields! After publishing your post, you should now be able to see the new fields.

If you have any questions, feel free to leave a comment below.

Video Tutorial

If you would prefer video tutorials:

OUR SERVICE

Fan Commerce

ファンコマース

ファンとのダイレクトなコミュニケーションを実現して「感動体験」をビジネスに結びつけます。

Digital Marketing

デジタルマーケティング

未来を創造する価値ある「顧客体験」を実現する仕組みづくりを提案。