ahmadawais / create-guten-block

📦 A zero-configuration #0CJS developer toolkit for building WordPress Gutenberg block plugins.
https://Awais.dev/cgb-post
MIT License
3.15k stars 328 forks source link

Add category #265

Open zkmark opened 4 years ago

zkmark commented 4 years ago

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

cgb

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' ), ], }

michaelslevy commented 4 years ago

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