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)

The topic ‘have_rows doesn\'t work inside function’ is closed to new replies.