Hey Elliot – We were using the following code to print the page title on the first content block within Flexible Content:
<?php
global $acf_field;
if($acf_field[0]['row'] == 0){
the_title('<h1>', '</h1>');
}
?>
But with the recent update to ACF, this no longer works, and actually prints out the Title on all content blocks created from Flexible Content. Any suggestions?
Thanks
Rich
Hi @jrstaatsiii
a smarter way to write this is to use a counter in your loop like so:
<?php if( have_rows('flex') ): $i = 0; ?>
<?php while( have_rows('flex') ): the_row(); $i++; ?>
<?php if( $i == 1 ): ?>
<?php the_title(); ?>
<?php endif; ?>
<?php endwhile; ?>
<?php endif; ?>
Thanks
E