-
Notifications
You must be signed in to change notification settings - Fork 0
/
wazframe-layout.php
67 lines (63 loc) · 1.51 KB
/
wazframe-layout.php
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
54
55
56
57
58
59
60
61
62
63
64
65
66
67
<?php
/**
* Plugin Name: WazFrame Layout
* Description: Block that enables side scrolling of content rather than wrapping.
* Requires at least: 5.8
* Requires PHP: 7.0
* Version: 0.2.3
* Author: Frank Wazeter
* License: GPL-2.0-or-later
* License URI: https://www.gnu.org/licenses/gpl-2.0.html
* Text Domain: wf-layout
*
*/
// Exit if accessed directly.
if ( ! defined( 'ABSPATH' ) ) {
exit;
}
/**
* Adds custom categories for blocks.
*
* @param $categories
*
* @return array
*/
function wazframe_block_categories( $categories ): array {
return array_merge(
$categories,
[
[
'slug' => 'layout-primitives',
'title' => __( 'Layout Primitives', 'wf-layout' ),
],
]
);
}
add_action( 'block_categories_all', 'wazframe_block_categories', 10, 2 );
/**
* 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 wf_layout_block_init() {
$blocks = array(
'reel',
'stack',
'box',
'center',
'cluster',
'sidebar',
'switcher',
'cover',
'grid',
'frame',
'imposter',
);
foreach ( $blocks as $block ) {
register_block_type( __DIR__ . "/build/block-library/{$block}" );
}
register_block_type( __DIR__ . "/build/block-library" );
}
add_action( 'init', 'wf_layout_block_init' );