create-guten-block
create-guten-block copied to clipboard
Add category
Feature Request
Is your feature request related to a problem? Please describe. A clear and concise description of what the problem is. Ex. I have an issue when [...]
add category option in init.php
so you can have a category with tab panel
Describe the solution you'd like A clear and concise description of what you want to happen. Add any considered drawbacks
generated code example init.php
//New Category //Categories For Editor add_filter('block_categories', 'cgb_categories', 10, 2); function cgb_categories( $categories, $post ){ return array_merge( $categories, array( array( 'slug' => 'create-guten-block', 'title' => 'Create Guten Blocks', 'icon' => 'awards' ), ) ); } .
in JS
registerBlockType( 'cgb/block-zafiro-blocks', { // Block name. Block names must be string that contains a namespace prefix. Example: my-plugin/my-custom-block. title: __( 'CGB Block' ), // Block title. icon: 'shield', // Block icon from Dashicons → https://developer.wordpress.org/resource/dashicons/. category: 'create-guten-block', // THE CATEGORY OF PHP keywords: [ __( 'zafiro-blocks — CGB Block' ), __( 'CGB Example' ), ], }
I'm not sure I understand your questions, but this is the documentation for adding a Gutenberg block category.
https://developer.wordpress.org/block-editor/developers/filters/block-filters/#managing-block-categories