Cannot connect Block to ACF field group
Hi, I have an issue when creating a new custom field group. I'm using ACF PRO 5.9.5 and WordPress 5.7. When adding the install to my theme I cannot add the Block in ACF (Show this field group if 'Block' is equal to ... ) I used the install (composer require "palmiak/timber-acf-wp-blocks") when I'm in the 'dist' folder. Am I doing something wrong?
My theme structure: dist:
- composer.json
- vendor
- composer
- palmiak
- wp-content
- plugins
- timber
- themes
- cec-theme
- views
- blocks
- testimonial.twig
- blocks
- views
- cec-theme
- plugins
-- Testimonial.twig code -- {# Title: Testimonial Description: Customer testimonial Category: formatting Icon: admin-comments Keywords: testimonial quote "customer testimonial" Mode: edit Align: left PostTypes: page post SupportsAlign: left right SupportsMode: false SupportsMultiple: false #}
{{ fields.testimonial }}
{{ fields.author }}
FWIW: I too was running into this and as a workaround the following worked:
// In functions.php
add_action( 'acf/init', 'timber_block_init', 10, 0 );
@Sandrio84 @jamacon36 - are both of you using Timber as a plugin rather than a composer library?
If so I would probably have to check if users are using plugin or library and change this part a bit:
public function __construct() {
if ( is_callable( 'add_action' )
&& is_callable( 'acf_register_block_type' )
&& class_exists( 'Timber' )
) {
add_action( 'acf/init', array( __CLASS__, 'timber_block_init' ), 10, 0 );
}
}