Support

Account

Home Forums Add-ons Repeater Field Repeater field – have_rows problems

Solved

Repeater field – have_rows problems

  • Hi. Having this strange problem:

    When one of the ‘echo’ line is commented it works – with both echos it does not.

    This works

    if( have_rows('business_udvalgte_pakker') ):
        while ( have_rows('business_udvalgte_pakker') ) : the_row();
            echo '<p>' . get_sub_field('business_udvalgte_pakker_prod') . '</p>';
            //echo '<p>' . get_sub_field('business_udvalgte_pakker_pris') . '</p>';
     endwhile;

    This works

    if( have_rows('business_udvalgte_pakker') ):
        while ( have_rows('business_udvalgte_pakker') ) : the_row();
            //echo '<p>' . get_sub_field('business_udvalgte_pakker_prod') . '</p>';
            echo '<p>' . get_sub_field('business_udvalgte_pakker_pris') . '</p>';
     endwhile;

    This DOES NOT work

    if( have_rows('business_udvalgte_pakker') ):
        while ( have_rows('business_udvalgte_pakker') ) : the_row();
            echo '<p>' . get_sub_field('business_udvalgte_pakker_prod') . '</p>';
            echo '<p>' . get_sub_field('business_udvalgte_pakker_pris') . '</p>';
     endwhile;

    business_udvalgte_pakker_prod = wysiwyg field
    business_udvalgte_pakker_pris = text field

  • This probably has something to do with other code in the template, because, assuming that there is an endif; line that you’re not including, there is nothing wrong with the small section of code that you gave. Can you provide a more significant portion of the code involved.

  • Hi John

    Thank you for your answer.

    I deleted the repeater fields, and made new ones – that fixed it.
    That could have saved me some hours doing that earlier 🙂

    Cheers
    Kris

Viewing 3 posts - 1 through 3 (of 3 total)

You must be logged in to reply to this topic.