Home › Forums › General Issues › How to register multiple ACF Gutenberg Blocks? › Reply To: How to register multiple ACF Gutenberg Blocks?
Apologies if this comes as duplicate posts. I have posted twice but did not go through.
I got a white editor page after I added the second register block. I got the editor back when I removed it and I am not sure what’s wrong as written. I will appreciate some help.
function register_acf_block_types() {
// register a testimonial block.
acf_register_block_type(array(
'name' => 'testimonial',
'title' => __('Testimonial'),
'description' => __('A custom testimonial block.'),
'render_template' => 'template-parts/blocks/testimonial/testimonial.php',
'category' => 'formatting',
'icon' => 'admin-comments',
'keywords' => array( 'testimonial', 'quote' ),
));
// register a testimonial block.
acf_register_block_type(array(
'name' => 'landing_page_content',
'title' => __('Landing Page'),
'description' => __('A custom landing page block.'),
'render_template' => 'template-parts/blocks/landing/page_landing.php',
'category' => 'formatting',
'icon' => 'dashicons-format-aside',
'keywords' => array( 'landing', 'card' ),
));
}
// Check if function exists and hook into setup.
if( function_exists('acf_register_block_type') ) {
add_action('acf/init', 'register_acf_block_types');
}
Welcome to the Advanced Custom Fields community forum.
Browse through ideas, snippets of code, questions and answers between fellow ACF users
Helping others is a great way to earn karma, gain badges and help ACF development!
We use cookies to offer you a better browsing experience, analyze site traffic and personalize content. Read about how we use cookies and how you can control them in our Privacy Policy. If you continue to use this site, you consent to our use of cookies.