Support

Account

Home Forums Add-ons Repeater Field have_rows doesn\'t work inside function

Unread

have_rows doesn\'t work inside function

  • I have a page in wich if i call the have rows in the flow of the page it works

    $listaEventoskey = 'field_5b7ecd7623a2b';

    this works (simplified the code and also tried like this):

    while(have_rows($listaEventoskey,'option')){
          the_row();
          $thisid = get_sub_field('eventid');
          echo "i have this: $thisid<br>";
     }

    but, this won’t work:

    function infoEvento() {
         while(have_rows($listaEventoskey,'option')){
          the_row();
          $thisid = get_sub_field('eventid');
          echo "i have this id $thisid<br>";
        }
    }
    infoEvento();

    update:

    tried with the field name instead of the key field and it worked, kind of annoying because its better/recommended to use the key_field to update a non existing row.

Viewing 1 post (of 1 total)

You must be logged in to reply to this topic.