How to display the number of the row of the repeater field please ?
In my project, one row = one step, so I want to display the left number of the row (in admin) on front office :
row 1 -> step 1
row 2 -> step 2
I hope my explanation is clear.
Thanks in advance !
Do you have it set up like this example?
@zaccety I think I figured out it had something to do with the placement of the function call. See here: https://github.com/solepixel/acf-modules/blob/master/modules/icon-blocks.php#L242
Notice that it’s outside “have_rows”. I’m pretty sure that’s all I needed to do and it returns the correct amount.
@meneldil My quick go to your question as I was searching for the answer myself.
if( have_rows('my_repeater') ): $i = 0; while( have_rows('my_repeater') ): the_row(); if( get_sub_field('sub_field_boolean') ) $i++; endwhile; $tCount = $i; endif;
($tCount to produce the number of rows with a true field)
The topic ‘How to display the number of the row of the repeater field ?’ is closed to new replies.
Welcome to the Advanced Custom Fields community forum.
Browse through ideas, snippets of code, questions and answers between fellow ACF users
Helping others is a great way to earn karma, gain badges and help ACF development!
📣 “ACF Chat Fridays”— Advanced Custom Fields (@wp_acf) January 31, 2023
The ACF team holds their first open office hours this Friday! Come and talk ACF, and ask questions about building sites with the plugin.
We’d love to see you there!
📆 Friday 3rd Feb - 3pm UTC
👉 Register here - https://t.co/3UtvQbE4CU pic.twitter.com/oTwW9K1XQ0
© 2023 Advanced Custom Fields.