I have a repeater query as directed in Section 4 on this page:https://www.advancedcustomfields.com/resources/query-posts-custom-fields/
I now can’t get just the sub fields within that row. What am I doing wrong?
<?php
// Unique ID from ACF
$uniqueID = $_POST['uniqueID'];
// filter
function my_posts_where( $where ) {
$where = str_replace("meta_key = 'projects_$", "meta_key LIKE 'projects_%", $where);
return $where;
}
add_filter('posts_where', 'my_posts_where');
// args
$args = array(
'numberposts' => -1,
'post_type' => 'client-dashboard',
'meta_key' => 'projects_$_unique_id',
'meta_value' => $uniqueID
);
// query
$the_query = new WP_Query( $args );
?>
<?php if( $the_query->have_posts() ): ?>
<?php while( $the_query->have_posts() ) : $the_query->the_post(); ?>
<!-- NEED Sub Fields for the one repeater row here -->
<?php endwhile; ?>
<?php endif; ?>
<?php wp_reset_query(); // Restore global post data stomped by the_post()
?>
For anyone wondering, I had to call for just that row with the following code:
while (have_rows('projects')) {
the_row();
if (get_sub_field('unique_id') != $uniqueID) {
// not our row
continue;
}
// REPEATER FIELD LOOP
include('items.php');
}