Home Forums Add-ons Repeater Field How do you output repeater field in a table?


How do you output repeater field in a table?

  • Hi. I created a repeater field called, ‘piece_details’ which includes 4 sub fields which are,

    1. performer-name
    2. piece
    3. composer
    4. minutes

    I wish to output the data in a table with a heading using an Elementor template. I pasted the code below in the function.php file in my Child Theme. However, nothing is showing after I used the ACF repeater widget to output the data. What am I doing wrong?

    // check if the repeater field has rows of data
    if( have_rows(‘piece_details’) ):

    // loop through the rows of data
    while ( have_rows(‘piece_details’) ) : the_row();

    // get a sub field value (table field)
    $table = sub_field(‘performer-name’);
    $table = sub_field(‘piece’);
    $table = sub_field(‘composer’);
    $table = sub_field(‘minutes’);

    // use the “Output Table HTML” code with $table


    else :

    // no rows found


  • I forgot to add that I used the Dynamic Content plugin for the Repeater Widget in Elementor Pro.

  • Hi Polyspora!

    In a while loop, get your sub field with get_sub_field('field_name') and not sub_field.

    You can direclty display your field with the_sub_field('field_name').


Viewing 3 posts - 1 through 3 (of 3 total)

You must be logged in to reply to this topic.

We use cookies to offer you a better browsing experience, analyze site traffic and personalize content. Read about how we use cookies and how you can control them in our Cookie Policy. If you continue to use this site, you consent to our use of cookies.