Support

Account

Home Forums General Issues How to register multiple ACF Gutenberg Blocks? Reply To: How to register multiple ACF Gutenberg Blocks?

  • 
    function register_acf_block_types() {
    	
    	// register a Carousel block
    	acf_register_block_type(array(
    		'name'				    => 'carousel',
    		'title'			 	    => __('Carousel'),
    		'description'		  => __('Show images in a carousel'),
    		'render_template'	=> 'blocks/carousel.php',
    		'category'			  => 'common',
    		'icon'				    => 'slides',
    		'keywords'			  => array( 'carousel', 'gallery' ),
        'mode'            => 'edit'
    	));
    	
    	// register a Card block
    	acf_register_block_type(array(
    		'name'				    => 'card',
    		'title'			 	    => __('Card'),
    		'description'		  => __('Card with photo and info'),
    		'render_template'	=> 'blocks/card.php',
    		'category'			  => 'common',
    		'icon'				    => 'id',
    		'keywords'			  => array( 'card', 'team' ),
        'mode'            => 'edit'
    	));
    }
    
    // Check if function exists and hook into setup.
    if( function_exists('acf_register_block_type') ) {
      add_action('acf/init', 'register_acf_block_types');
    }
    

    I tried the same thing. When I add the Carousel in the editor I get just the Carousel, but when I try to add the Card, it shows the Carousel and the Card in the same block which I don’t want.

    Anyone else having this problem? What am I missing?