Layout Function Examples

Create your own Custom Blocks

Add a new layout within the Row width(s) you want it available within. Then put a function similar to the following into your functions.php, matching your layout field name to the layout block you created in Advanced Custom Fields

function IDP_custom_layouts($type){
	if( $type == 'custom_layout_name' ):
		$field = get_sub_field('field_name');
        $layout = $field;
	endif;
    return $layout;
}
add_filter( 'flexible_layout', 'IDP_custom_layouts');

Column Wrappers

If you need to wrap each rows outer .container, use a function similar to below, this uses an option field called 'column_wrap' with 3 radio options of 'style1', 'style2', and 'end'

add_filter( 'flexible_columns_wrap_outer', 'IDP_Column_WrapOuter');
add_filter( 'flexible_columns_wrap_outer_end', 'IDP_Column_WrapOuter_End');
function IDP_Column_WrapOuter(){
	$wrap = get_sub_field('column_wrap');
	if( $wrap == 'style1' ) $output = '
'; if( $wrap == 'style2' ) $output = '
'; return $output; } function IDP_Column_WrapOuter_End(){ $wrap = get_sub_field('angled_background'); if( $wrap == 'end' || $wrap == 'style1' || $wrap == 'style2') $output = '
'; return $output; }

To wrap the inside the container use the following:

add_filter( 'flexible_columns_wrap_inner', 'IDP_Column_WrapInner');
add_filter( 'flexible_columns_wrap_inner_end', 'IDP_Column_WrapInner_End');
function IDP_Column_WrapOuter(){
	$wrap = get_sub_field('column_wrap');
	if( $wrap == 'style1' ) $output = '
'; if( $wrap == 'style2' ) $output = '
'; return $output; } function IDP_Column_WrapOuter_End(){ $wrap = get_sub_field('angled_background'); if( $wrap == 'end' || $wrap == 'style1' || $wrap == 'style2') $output = '
'; return $output; }

Class Modifiers/Extendors

If you need to modify or add additional classes to the column div use this filter:

function idp_ColClasses($classes, $therow){
	global $post;
	$showborder = $therow['enable_border'];
	if( $showborder ) $classes[] = 'border';
	return $classes;
}
add_filter( 'flexible_columns_col_class', 'idp_ColClasses', 10, 2);

To modify/add classes to the row div:

function idp_RowClass($class){
	$newclass = 'rowbackground';
	$class[] = $newclass;
	return $class;
}
add_filter( 'flexible_columns_row_class', 'idp_RowClass');