Home › Forums › ACF PRO › Repeater Field looping the last results › Reply To: Repeater Field looping the last results
ok. i know the problem. could you try if this works for you
<!-- model specifications -->
<?php if( have_rows('model_specifications') ):
$firstrow = "1";
while( have_rows('model_specifications') ): the_row();
$ms_model = get_sub_field('model');
$ms_gpm = get_sub_field('gpm');
$ms_input = get_sub_field('input');
$ms_psi = get_sub_field('psi');
$ms_drive = get_sub_field('drive');
$ms_rpm = get_sub_field('rpm');
$ms_drive_rpm = get_sub_field('drive_rpm');
$ms_hp = get_sub_field('hp');
$ms_volt = get_sub_field('volt');
$ms_hp_volt = get_sub_field('hp_volt');
$ms_power = get_sub_field('power');
$ms_engine = get_sub_field('engine');
$ms_burner = get_sub_field('burner');
$ms_electric_start = get_sub_field('electric_start');
$ms_size = get_sub_field('size');
if($firstrow == "1") :
echo '<div id="model-specifications">';
echo '<table class="rwd-table">';
echo '<thead>';
echo '<tr>';
if ($ms_model) {echo '<th>Model</th>';}
if ($ms_gpm) {echo '<th>GPM</th>';}
if ($ms_input) {echo '<th>Input</th>';}
if ($ms_psi) {echo '<th>PSI</th>';}
if ($ms_drive) {echo '<th>Drive</th>';}
if ($ms_rpm) {echo '<th>RPM</th>';}
if ($ms_drive_rpm) {echo '<th>Drive RPM</th>';}
if ($ms_hp) {echo '<th>HP</th>';}
if ($ms_volt) {echo '<th>Volt</th>';}
if ($ms_hp_volt) {echo '<th>HP / Volt</th>';}
if ($ms_power) {echo '<th>Power</th>';}
if ($ms_engine) {echo '<th>Engine</th>';}
if ($ms_burner) {echo '<th>Burner</th>';}
if ($ms_electric_start) {echo '<th>Electric Start</th>';}
if ($ms_size) {echo '<th>Size</th>';}
echo '<th>Quote</th>';
echo '</tr>';
echo '</thead>';
echo '<tbody>';
endif;
$firstrow++;
echo '<tr>';
if ($ms_model) {echo '<td data-th="Model">'.$ms_model.'</td>';}
if ($ms_gpm) {echo '<td data-th="GPM">'.$ms_gpm.'</td>';}
if ($ms_input) {echo '<td data-th="Input">'.$ms_input.'</td>';}
if ($ms_psi) {echo '<td data-th="PSI">'.$ms_psi.'</td>';}
if ($ms_drive) {echo '<td data-th="Drive">'.$ms_drive.'</td>';}
if ($ms_rpm) {echo '<td data-th="RPM">'.$ms_rpm.'</td>';}
if ($ms_drive_rpm) {echo '<td data-th="Drive RPM">'.$ms_drive_rpm.'</td>';}
if ($ms_hp) {echo '<td data-th="HP">'.$ms_hp.'</td>';}
if ($ms_volt) {echo '<td data-th="Volt">'.$ms_volt.'</td>';}
if ($ms_hp_volt) {echo '<td data-th="HP / Volt">'.$ms_hp_volt.'</td>';}
if ($ms_power) {echo '<td data-th="Power">'.$ms_power.'</td>';}
if ($ms_engine) {echo '<td data-th="Engine">'.$ms_engine.'</td>';}
if ($ms_burner) {echo '<td data-th="Burner">'.$ms_burner.'</td>';}
if ($ms_electric_start) {echo '<td data-th="Electric Start">'.$ms_electric_start.'</td>';}
if ($ms_size) {echo '<td data-th="Size">'.$ms_size.'</td>';}
echo '<td data-th="Quote"><a href="/request-a-quote/?">Request a Quote</a></td>';
echo '</tr>';
endwhile;
echo '</tbody>';
echo '</table>';
echo '</div>';
?>
<?php endif; ?>
<!-- end model specifications -->
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.