I wish to output a data from a repeater field in a table.
-
Hi. I have ACF Pro and I created a repeater field called, ‘piece_details’ which includes 4 sub fields which are,
1. performer-name
2. piece
3. composer
4. minutesI 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
endwhile;
else :
// no rows found
endif;
- The topic ‘I wish to output a data from a repeater field in a table.’ is closed to new replies.