-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathseries.php
56 lines (51 loc) · 1.29 KB
/
series.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
<?php
/**
* Functions to register client-side assets (scripts and stylesheets) for the
* Gutenberg block.
*
* @package twentyseventeen
*/
/**
* Registers all block assets so that they can be enqueued through Gutenberg in
* the corresponding context.
*
* @see https://wordpress.org/gutenberg/handbook/blocks/writing-your-first-block-type/#enqueuing-block-scripts
*/
function series_block_init() {
$dir = get_template_directory() . '/blocks';
$index_js = 'series/index.js';
wp_register_script(
'series-block-editor',
get_template_directory_uri() . "/blocks/$index_js",
array(
'wp-blocks',
'wp-i18n',
'wp-element',
),
filemtime( "$dir/$index_js" )
);
$editor_css = 'series/editor.css';
wp_register_style(
'series-block-editor',
get_template_directory_uri() . "/blocks/$editor_css",
array(
'wp-blocks',
),
filemtime( "$dir/$editor_css" )
);
$style_css = 'series/style.css';
wp_register_style(
'series-block',
get_template_directory_uri() . "/blocks/$style_css",
array(
'wp-blocks',
),
filemtime( "$dir/$style_css" )
);
register_block_type( 'twentyseventeen/series', array(
'editor_script' => 'series-block-editor',
'editor_style' => 'series-block-editor',
'style' => 'series-block',
) );
}
add_action( 'init', 'series_block_init' );