HTML
<?php get_template_part('inc/added-blocks-section') ?>
PHP
// Loop through rows.
while ( have_rows('afer_content_blocks') ): the_row();
$all_fields = array();
$subfields = get_row();
if( $subfields ){
foreach ( $subfields as $name => $value ) {
$field_object = get_sub_field_object( $name );
if( isset( $field_object['_name'] ) && isset( $field_object['value'] ) ){
$all_fields[ $field_object['_name'] ] = $field_object['value'];
}
}
}
$field_name = get_row_layout();
$file = "inc/page-parts/".$field_name;
$located = locate_template( $file.'.php' );
if( !empty( $located ) ){
// $options = get_sub_field('options');
if( $all_fields ){
$args_section = array(
'name' => $field_name,
'data' => $all_fields,
);
get_template_part( $file, null, $args_section );
}
} else {
if( is_super_admin() ){
echo '<pre class="kung-fu-panda" style="direction:ltr;text-align:left;">';
print_r( $field_name );
echo '</pre>';
}
}
endwhile;