Support

Account

Home Forums Add-ons Flexible Content Field Count flexible field sub fields Reply To: Count flexible field sub fields

  • Looks like I was just getting the page count in the wrong place. Here’s a working solution.

    <?php $pagecount = 0;
    
    while( has_sub_field("content") ) : 
      
      if(get_row_layout() == "page_break") :
      
        if(get_sub_field('break_here')){
          $pagecount++;	
        }
        
      endif;
    endwhile;
    ?>

    Then I can just use $pagecount elsewhere:

    <?php echo $pagecount; ?>