Home › Forums › Add-ons › Repeater Field › Using get_post_meta as Fallback on Repeaters › Reply To: Using get_post_meta as Fallback on Repeaters
that is good. you see that it works 😉
the 8 is because you echo $row_count--;
and testimonials_7_testimonial is the field name for the last row.
now use something like that:
$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;
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.