Support » Fixing WordPress » Set default state to edit for custom gallery block

  • Resolved vectyr

    (@vectyr)


    Hey there, I just figured out how to create custom blocks with Advanced Custom Fields and I got everything working except for one thing that I have spent hours researching.

    Here’s what I have in my functions.php to create the block:

    
    add_action('acf/init', 'my_acf_init');
    function my_acf_init() {
    	
    	// check function exists
    	if( function_exists('acf_register_block') ) {
    		
    		// register a testimonial block
    		acf_register_block(array(
    			'name'				    => 'carousel',
    			'title'			 	    => __('Carousel'),
    			'description'		  => __('Show images in a carousel.'),
    			'render_template'	=> 'blocks/carousel.php',
    			'category'			  => 'common',
    			'icon'				    => 'slides',
    			'keywords'			  => array( 'carousel', 'gallery' ),
    		));
    	}
    }
    

    My problem is actually in the editor when I add my carousel block. It starts off in preview mode which shows aboslutely nothing and I’d rather it default to edit mode but I cannot figure out how to do this and it seems like the answer should be simple.

    Any help would be appreciated, I think an answer to this might help someone else out there as well.

Viewing 4 replies - 1 through 4 (of 4 total)
Viewing 4 replies - 1 through 4 (of 4 total)
  • The topic ‘Set default state to edit for custom gallery block’ is closed to new replies.