-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathplugin.php
More file actions
54 lines (48 loc) · 1.45 KB
/
plugin.php
File metadata and controls
54 lines (48 loc) · 1.45 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
<?php
/**
* Plugin Name: Custom Blocks Toolkit
* Description: Gutenberg Custom Blocks Toolkit
* Requires at least: 6.1
* Requires PHP: 7.0
* Version: 0.1.0
* Author: Saief Al Emon
* Author URI: https://iamsaief.com/
* License: GPL-2.0-or-later
* License URI: https://www.gnu.org/licenses/gpl-2.0.html
* Text Domain: custom-blocks-toolkit
*
* @package create-block
*/
if ( ! defined( 'ABSPATH' ) ) {
exit; // Exit if accessed directly.
}
/**
* Registers the block using the metadata loaded from the `block.json` file.
* Behind the scenes, it registers also all assets so they can be enqueued
* through the block editor in the corresponding context.
*
* @see https://developer.wordpress.org/reference/functions/register_block_type/
*/
function custom_blocks_toolkit_init() {
$blocks = array(
'team-members', 'latest-posts'
);
foreach ($blocks as $block) {
register_block_type(
__DIR__ . '/build/blocks/' . $block
);
};
// Adding custom block category.
add_filter('block_categories_all', function ($categories) {
return array_merge(
array(
array(
'slug' => 'custom-blocks-toolkit',
'title' => 'CUSTOM BLOCKS TOOLKIT'
),
),
$categories
);
}, 10, 2);
}
add_action( 'init', 'custom_blocks_toolkit_init' );