Support

Account

Home Forums Add-ons Flexible Content Field How to determine the number of rows that will render in flexible content Reply To: How to determine the number of rows that will render in flexible content

  • Got it! This just happens to be a nested flexible content field.

    <?php if (get_row_layout() == 'flexibl_content_field') :
        $layouts = get_sub_field('sub_flexible_content_field');
        $layoutsCount = count($layouts);
    ?>

    and use it like this in the while loop
    <div class="col-md-6 <?php echo $layoutsCount == 3 ? 'col-lg-4' : 'col-lg-6'; ?>