Home › Forums › Add-ons › Repeater Field › Splitting fields into table rows › Reply To: Splitting fields into table rows
Hi @ordog ,
Here is a sample using two while loops to show the data. Let me know if it helps.
<table>
<?php while( have_rows('my_repeater') ): the_row();
// vars
$field1 = get_sub_field('field1');
$field2 = get_sub_field('field2');
?>
<tr>
// All $field1 and $field2 fields in this row each wrapped in <td> tags
<td><?php echo $field1; ?></td>
<td rowspan="2"><?php echo $field2; ?></td>
</tr>
<tr>
<?php endwhile; ?>
<?php while( have_rows('my_repeater') ): the_row();
$field3 = get_sub_field('field3');
?>
<tr>
// All $field 3 in this row wrapped in <td> tags
<td><?php echo $field3; ?></td>
</tr>
<?php endwhile; ?>
</table>
Hopefully this helps. 🙂
Welcome to the Advanced Custom Fields community forum.
Browse through ideas, snippets of code, questions and answers between fellow ACF users
Helping others is a great way to earn karma, gain badges and help ACF development!
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 Privacy Policy. If you continue to use this site, you consent to our use of cookies.