-
Notifications
You must be signed in to change notification settings - Fork 2
/
Copy pathcustom-functions.php
43 lines (37 loc) · 963 Bytes
/
custom-functions.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
<?php
add_action( 'init', 'register_block' );
/**
* Register block and styles
*/
function register_block() {
// Block front end styles.
wp_register_style(
'gtcb-block-front-end-styles',
GTCB_BLOCKS_URL . '/src/style.css',
[],
filemtime( GTCB_BLOCKS_PATH . '/src/style.css' )
);
// Block editor styles.
wp_register_style(
'gtcb-block-editor-styles',
GTCB_BLOCKS_URL . '/src/editor.css',
['wp-edit-blocks'],
filemtime( GTCB_BLOCKS_PATH . '/src/editor.css' )
);
// Block Editor Script.
wp_register_script(
'gtcb-block-editor-js',
GTCB_BLOCKS_URL . '/build/index.js',
array( 'wp-blocks', 'wp-element', 'wp-editor', 'wp-components', 'wp-i18n' ),
filemtime( GTCB_BLOCKS_PATH . '/build/index.js' ),
true
);
register_block_type(
'gtcb-blocks/custom-block',
array(
'style' => 'gtcb-block-front-end-styles',
'editor_style' => 'gtcb-block-editor-styles',
'editor_script' => 'gtcb-block-editor-js',
)
);
}