php - Find total number of $count++ in while loop -


i have basic counter going echoes out number each paragraph in content, , need find total number of loops counter...

<?php     $count = 0;     // check if repeater field has rows of data     if( have_rows('each_class_event') ):     // loop through rows of data     while ( have_rows('each_class_event') ) : the_row(); ?>         <?php $count++; ?>      <div class="eachone">        <div class="classinfo">             <p>session <?php echo $count; ?></p>         </div>      </div> 

in paragraph need like:

    <p>session <?php echo $count; ?> of <?php echo $totalcount; ?></p> 

the solution worked me treating custom field in wordpress array , using this...

    <p>session <?php echo $count; ?> of <?php echo count( get_field('each_class_event') ); ?></p> 

Comments

Popular posts from this blog

javascript - Bootstrap Popover: iOS Safari strange behaviour -

Magento/PHP - Get phones on all members in a customer group -

session - Logging Out Using PHP -