Support

Account

Forum Replies Created

  • I ran into this issue as well for a general wrapper block with default options, ACF support for innerblocks would be awesome!

  • As i see it, it is easy to add the custom css class to your block, you can decide where to place the css class in the same way as you would set your block alignment.

    You can use $block to get gutenberg settings.

    Place $block[‘className’] in the containing div of your block element, and then it should work.

    There are other values stored in $block as well:

    ‘name’
    ‘title’
    ‘description’
    ‘category’
    ‘icon’
    ‘mode’
    ‘align’
    ‘keywords’
    ‘supports’
    ‘post_types’
    ‘render_template’
    ‘render_callback’
    ‘multiple’
    ‘className’
    ‘data’
    ‘id’

    Hope this helps!

  • Hi Tom,

    I was expirimenting with the same thing as i couldnt find information about this.

    But for example:

    First You create a custom block via acf_register_block:

    
    acf_register_block(
    array(
    	'name'              => 'blockname',
    	'title'             => __('title'),
    	'description'       => __('description')
    		
    ));
    

    Then you can take the name of the acf_block ‘blockname’ and use it as following in your post type template:

    
    	$post_type_object->template = array(
    		array( 'acf/blockname', array() ),		
    	);
    

    Note: If your blockname contains a space or a underscore, acf renames this to a dash, so ‘block_name’ becomes ‘block-name’.

    Hope this helps!

Viewing 3 posts - 1 through 3 (of 3 total)