0

i want to count number of sub field of repeater ACF thas my code

<?php
   $cards = get_sub_field('agence_post');
   if(have_rows('agence_post')):
      $number_of_cards = count($cards);
      echo $number_of_cards;
  endif;
?>
  • 3
    Possible duplicate of [How to count the total number of rows in a ACF repeater output](https://stackoverflow.com/questions/43788167/how-to-count-the-total-number-of-rows-in-a-acf-repeater-output) – Nicolas Roehm Dec 25 '18 at 12:32

1 Answers1

-1

Hello You can get no of subfields by using this function

<?php $numrows = count( get_sub_field( 'agence_post' ) );
  echo $numrows;?>
Piyush Dhanotiya
  • 559
  • 4
  • 18