Your Location is: Home > Advanced-custom-fields

How Can I fix this ACF Repeater Block code to render on from end

From: Dublin View: 3846 dareadel 


I am using the ACF Pro Repeater Fields for a project with the location as a Block. The block successfully loaded on the edit page but it not being rendered to the front end.

Here is the code I used to test the page Template:

`//Register a Building Projects Block add_action('acf/init', 'my_acf_init_block_types'); function my_acf_init_block_types() {

// Check function exists.
if( function_exists('acf_register_block_type') ) {

     // register a building project block.
        'name'              => 'building_projects',
        'title'             => __('Building Projects'),
        'description'       => __('A custom block for Building Projects.'),
        'render_template'   => get_template_directory() . '/template-parts/blocks/building-projects/building-projects.php',
        'category'          => 'formatting',
        'icon'              => 'building',
        'keywords'          => array( 'building', 'nodaco' ),


// Load values and assign defaults.

$sub_text = get_sub_field('project_descriptions') ?: 'Detail Project here...';


I also echoed with this line of code: echo($sub_text);`

Best answer

The issues were much more beyond the ACF plugin. I simply debugged with

define( 'WP_DEBUG', true ); define( 'WP_DEBUG_LOG', true );

which revealed the true the coding issues in both the function.php file and then the template file. It took me several hours to clean up the codes and the fields began to display as expected.