-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathindex.php
More file actions
32 lines (28 loc) · 963 Bytes
/
index.php
File metadata and controls
32 lines (28 loc) · 963 Bytes
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
<?php
/**
* Plugin Name: Persistent Checkboxes
* Description: Gutenberg block that renders checkboxes whose state will be persisted in the end user's browser.
* Version: 0.1.0
* Requires at least: 5.3.0
* Author: Dylan Price
* License: GPLv3
* License URI: https://www.gnu.org/licenses/gpl-3.0.html
*
* @package persistent-checkboxes
*/
function persistent_checkboxes_register_block() {
$asset_file = include( plugin_dir_path( __FILE__ ) . 'build/index.asset.php' );
wp_register_script(
'persistent-checkboxes-script',
plugins_url( 'build/index.js', __FILE__ ),
$asset_file['dependencies'],
$asset_file['version']
);
if ( function_exists( 'register_block_type' ) ) {
register_block_type(
'persistent-checkboxes/persistent-checkboxes',
array( 'script' => 'persistent-checkboxes-script' )
);
}
}
add_action( 'init', 'persistent_checkboxes_register_block' );