Last active
January 29, 2021 17:27
-
-
Save kaelri/56f1b39c3cc49dd3ff4b9425608872ad to your computer and use it in GitHub Desktop.
ACF Block with Inner Blocks Template
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| <?php | |
| class myBlock { | |
| public static function setup() { | |
| add_action('acf/init', [ __CLASS__, 'register' ] ); | |
| } | |
| public static function register() { | |
| acf_register_block([ | |
| 'name' => 'my-block', | |
| 'title' => __('My Block'), | |
| 'description' => __('A super cool block.'), | |
| 'render_callback' => [ __CLASS__, 'render' ], | |
| 'category' => 'my-category', | |
| 'icon' => 'images-alt2', | |
| 'keywords' => [ 'custom' ], | |
| 'supports' => [ | |
| 'align' => true, | |
| 'mode' => false, | |
| 'jsx' => true | |
| ], | |
| ]); | |
| } | |
| public static function render( $block ) { | |
| ?><section class="my-block"> | |
| <div class="my-block-inner"> | |
| <InnerBlocks /> | |
| </div> | |
| </section><?php | |
| } | |
| } |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment