Home > AI > Backend > Wordpress > Guternberg >

create a block category

Put this code in the functions.php, in plugin, or other places which can be executed.

function st_quiz_block_category( $categories, $post ) {
        return array_merge(
            $categories,
            array(
                array(
                    'slug' => 'pte-quiz-cat',
                    'title' => __( 'PTE Quiz', 'pte-quiz' ),
                ),
            )
        );
    }
    add_filter( 'block_categories', 'st_quiz_block_category', 10, 2);

Then you need to attach a block to this type that you can see the result.

blocks.registerBlockType( 'pte-quiz/speaking-asq', {
		title: __( 'Speaking:ASQ', 'pte-quiz' ),
		icon: 'universal-access-alt',
		category: 'pte-quiz-cat',
	} );

Leave a Reply