Home › Forums › General Issues › Missing repeater fields for 1st post only › Reply To: Missing repeater fields for 1st post only
I have learned that if I use PHP foreach
code, I can get the sub field values. This code snippet works:
if ( $the_query->have_posts() ) :
while ( $the_query->have_posts() ) : $the_query->the_post();
$committees .= '<p><strong>'.get_the_title().'</strong>';
$members = get_field('committee_members' );
foreach ($members as $member) {
$committees .= '<br>'.$member['member'];
}
$committees .= '</p>';
endwhile;
endif;
The previous code using while( have_rows() )
does not, again only for the first post.
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.