Support

Account

Home Forums Add-ons Repeater Field Top Item of Repeater Field Not Showing

Solved

Top Item of Repeater Field Not Showing

  • 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.

    Anyone else seen this particular issue?

  • Yeah, I’m having the same issue as well.

    I realize it’s an old thread, but did you manage to find a solution for this?

  • 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
            the_sub_field('sub_field_name');
     
        endwhile;
     
    else :
     
        // no rows found
     
    endif;
    
  • I’ve used the code above, but not showing still.

  • 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)

The topic ‘Top Item of Repeater Field Not Showing’ is closed to new replies.