Last active
June 18, 2020 08:30
-
-
Save lkhedlund/70c35cdd46670373af2b6af2751d5020 to your computer and use it in GitHub Desktop.
Gutenberg: Custom Block Category
This file contains 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
registerBlockType( 'loomo/yoshi-cookies', { | |
category: 'mario-blocks', // Block category |
This file contains 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 | |
function my_mario_block_category( $categories, $post ) { | |
return array_merge( | |
$categories, | |
array( | |
array( | |
'slug' => 'mario-blocks', | |
'title' => __( 'Mario Blocks', 'mario-blocks' ), | |
), | |
) | |
); | |
} | |
add_filter( 'block_categories', 'my_mario_block_category', 10, 2); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment