Support

Account

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.