php

Split an ACF Flexible content field into Template Parts

If you're working on a project with lots of Flexible content field 'rows' it can really help to break them into template parts

If you’re working on a project with lots of Flexible content field ‘rows’ it can really help to break them into template parts

<?php
// In a post/page template, loop over the ACF flexible field layouts and load the partial
// responsible for rendering the layout. 
while ( the_flexible_field('my_flexi_field') ) {
	get_template_part( 'components/'. get_row_layout() );
}