The Repeater field creates a field where sub-fields can be displayed repeatedly.

This field type is exclusive to Block Lab Pro.


Repeater Field

  • Help Text: Instructions to describe the data needed in the field
  • Default Value: The default value to use for this field when adding the block

Repeater Sub-fields

  • Help Text: Instructions to describe the data needed in the field.
  • Default Value: The default value for this sub-field when adding to the block.
  • Placeholder Text: The helper text which appears when the input is empty.
  • Character Limit: The maximum number of characters allowed to be entered.

PHP API Controls

  • name
  • label
  • control
  • type
  • order
  • help
  • min
  • max

Template Usage

To display the Repeater field and sub-fields in your template, use the field and sub-field names you provided. In this example the field’s name is pets-medical-concerns and the sub-field’s name is pets-medical-condition.

Example template file /blocks/block-block-lab-example.php

 // Block Lab Example Repeater Field

if ( block_rows( 'pets-medical-concerns' ) ):
    echo '<h2>Pet\'s Medical Conditions</h2>';
    echo '<ul>';

    while ( block_rows( 'pets-medical-concerns' ) ) :
        block_row( 'pets-medical-concerns' );

        echo '<li>';
        block_sub_field( 'pets-medical-condition' );
        echo '</li>';

    echo '</ul>';

reset_block_rows( 'pets-medical-concerns' );

To use the block with the Repeater field on your site, locate it in the blocks menu.

It will then display within your post/page.

And on the front-end of your site.

For more details on how to use the Repeater field, check out the associated Repeater functions: