Home › Forums › Add-ons › Repeater Field › Using get_post_meta as Fallback on Repeaters › Reply To: Using get_post_meta as Fallback on Repeaters
tried to this using
$rows = get_post_meta( 348, 'testimonials', false ); // get number of rows (8 but in a array)
$row_count = $rows[0]; //get row number out of array (8)
echo $row_count--; // because first row start with 0 not 1 subtract one from row number (8-1 =7)
//now you could use $row_count to get last row (7)
$lastrow = 'testimonials_'.$row_count.'_testimonial'; //you need to replace echo by a variable and use that
echo $lastrow;
What i get front end is
8testimonials_7_testimonial
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!
ACF’s Repeater field is a versatile solution for repeating content in #WordPress.
— Advanced Custom Fields (@wp_acf) December 29, 2022
What’s your favorite use case for the Repeater field?
What’s the weirdest thing you’ve ever used it for?
Let us know!👇
© 2023 Advanced Custom Fields.
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 Cookie Policy. If you continue to use this site, you consent to our use of cookies.