Hi. I created a repeater field called, ‘piece_details’ which includes 4 sub fields which are,
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
// no rows found
I forgot to add that I used the Dynamic Content plugin for the Repeater Widget in Elementor Pro.
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