How to use ACF get_row_index() to echo repeater row index?

Hello Bricks Builder Genius,

Here is my testing page.
I have used ACF repeater to builder a field and bricks query loop already.
Now I tried to echo repeater index(I’m going to use it to represent the chapter numbers) using ACF function get_row_index(), and here is what I did:


However, I get all ‘1’ instead of row index.
I know it’s rediculous to echo a ACF loop filed function… but I almost tried every method by now.
Does anyone know how to echo the repeater row index? I would appreciate any help.
Thank you!

Pew

If you instead use a code block inside the query loop, rather than using the echo dynamic tag. You could use Bricks’ function ‘get_loop_index’ (index starts at 0, instead of 1 though so need to add 1 to replicate what ACF’s function would have given you)

echo intval( Bricks\Query::get_loop_index() ) + 1 ?>
1 Like

Thank you very much, it works like a charm!

Is there a way to obtain the complete ACF path, including parent repeaters? To clarify my question, let’s consider the following ACF group field structure:

  1. Program
    1.1 Week
    1.1.1 Workout
    1.1.1.1 (Exercise, Variant, Reps, Sets, Intensity, KG, “Done”)

In order to update the “Done” field using Bricks form and a custom action, I need to retrieve the index of “Done” as well as its parent elements. How can I accomplish this?