Support

Account

Home Forums Front-end Issues Count total number of post objects Reply To: Count total number of post objects

  • 
    $count = count(get_field('featured_developments'));
    if (have_rows('featured_developments')) {
    	$class = 'lg-col-4 md-col-4';
    	if ($count == 1) {
    		$class = 'lg-col-12';
    	}
    	if ($count == 2) {
    		$class = 'lg-col-6 md-col-6';
    	}
    	while (have_rows('featured_developments')) {
    		the_row();
    		?><div class="<?php echo $class; ?>"><?php echo $class; ?></div><?php 
    	}
    }