-
Notifications
You must be signed in to change notification settings - Fork 0
/
gutenberg-practice-03.php
52 lines (47 loc) · 1.12 KB
/
gutenberg-practice-03.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
<?php
/**
* Plugin Name: Gutenberg Practice 03
* Plugin URI: https://github.com/drill-lancer/gutenberg-practice-03
* Description: Block Build Test
* Version: 0.0.1
* Author: DRILL LANCER
*
* @package Gutenberg Practice 01
*/
/**
* Register Scripts
*/
function gutenberg_practice_03_register() {
$asset_file = include plugin_dir_path( __FILE__ ) . 'build/index.asset.php';
wp_register_script(
'gutenberg-practice-03',
plugins_url( 'build/index.js', __FILE__ ),
$asset_file['dependencies'],
$asset_file['version'],
true
);
wp_register_style(
'gutenberg-practice-03',
plugins_url( 'style.css', __FILE__ ),
array(),
$asset_file['version']
);
register_post_meta(
'post',
'gutenberg_practice_03_block_field',
array(
'show_in_rest' => true,
'single' => true,
'type' => 'string',
)
);
}
add_action( 'init', 'gutenberg_practice_03_register' );
/**
* Enqueue Scripts
*/
function gutenberg_practice_03_enqueue() {
wp_enqueue_style( 'gutenberg-practice-03' );
wp_enqueue_script( 'gutenberg-practice-03' );
}
add_action( 'enqueue_block_editor_assets', 'gutenberg_practice_03_enqueue' );