-
Notifications
You must be signed in to change notification settings - Fork 16
Expand file tree
/
Copy pathplugin.php
More file actions
48 lines (39 loc) · 1.06 KB
/
plugin.php
File metadata and controls
48 lines (39 loc) · 1.06 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
<?php
/**
* Plugin Name: My Cool Border Box
* Author: Brad
* Version: 1.0.0
*/
function loadMyBlockFiles() {
wp_enqueue_script(
'my-super-unique-handle',
plugin_dir_url(__FILE__) . 'my-block.js',
array('wp-blocks', 'wp-i18n', 'wp-editor'),
true
);
}
add_action('enqueue_block_editor_assets', 'loadMyBlockFiles');
/* To make your block "dynamic" uncomment
the code below and in your JS have your "save"
method return null
*/
/*
function borderBoxOutput($props) {
return '<h3 style="border: 5px solid' . $props['color'] . '">' . $props['content'] . '</h3>';
}
register_block_type( 'brad/border-box', array(
'render_callback' => 'borderBoxOutput',
) );
*/
/* To Save Post Meta from your block uncomment
the code below and adjust the post type and
meta name values accordingly. If you want to
allow multiple values (array) per meta remove
the 'single' property.
*/
/*
function myBlockMeta() {
register_meta('post', 'color', array('show_in_rest' => true, 'type' => 'string', 'single' => true));
}
add_action('init', 'myBlockMeta');
*/