Fall Back ACF Repeater code using get_post_meta
<?php
if( function_exists('get_field') ){
//Display Latest Testimonial Row with ACF;
echo '<div class="info">';
$rows = get_field( 'testimonials', 348 ); // get all the rows
$end_row = end($rows); // get the end row
$end_testimonial_content = $end_row['testimonial' ]; // get the sub field value
$end_testimonial_header = $end_row['testimonial_header' ]; // get the sub field value
$last = '<blockquote>' . $end_testimonial_content . '</blockquote><p>' . $end_testimonial_header . '</p>';
echo $last;
echo '</div>';
}
else {
//Fallback without ACF for Repeater field;
//Repeaters are stored as - $ParentName_$RowNumber_$ChildName
/*Example below $ParentName = testimonials,which is the ACF Fieldgroup,
* $RowNumber is the row number
* $ChildName are the subfield value
*
* $ParentName_$RowNumber_$ChildName = testimonials_4_testimonial
* $ParentName_$RowNumber_$ChildName = testimonials_4_testimonial_header
*/
echo '<div class="info">';
$rows = get_post_meta( 348, 'testimonials', false ); // get number of rows, is inside a array
$row_count = $rows[0]; //get row number out of array
$row_count--; // because first row start with 0 not 1 subtract one from row number
$lastrow_content = 'testimonials_'.$row_count.'_testimonial'; //get last row field
$lastrow_head = 'testimonials_'.$row_count.'_testimonial_header'; //get last row field
$end_testimonial_content = get_post_meta( 348, $lastrow_content, true );// get the last row value
$end_testimonial_header = get_post_meta( 348, $lastrow_head, true ); // get the last row value
$last = '<blockquote>' . $end_testimonial_content . '</blockquote><p>' . $end_testimonial_header . '</p>';
echo $last;
echo '</div>';
}