Seems to be a bug or glitch with a repeater field on a site I’m building. The repeater is very simple, only one field – a Post Object selection referencing another Custom Post Type. Then on the front-end I’m just using the standard while_has_subfield() function, but for some reason the first item is never showing.
You have to use the new repeater field code. while_has_subfield is deprecated…
// check if the repeater field has rows of data
if( have_rows('repeater_field_name') ):
// loop through the rows of data
while ( have_rows('repeater_field_name') ) : the_row();
// display a sub field value
// no rows found
I retained my code but moved my entire while loop out into the parent template and now it’s working and showing all my entries.
I tried the have_rows and it doesn’t make a difference for me. Interestingly though, a var_dump shows that get_field() is actually returning all the rows, but the first row is disregarded once I enter the while loop.
The documentation said something about it not working right if it’s inside an if block, but I don’t recall ever having this problem before.
Viewing 5 posts - 1 through 5 (of 5 total)
You must be logged in to reply to this topic.
Welcome to the Advanced Custom Fields community forum.
Browse through ideas, snippets of code, questions and answers between fellow ACF users