-
Notifications
You must be signed in to change notification settings - Fork 1
/
blissful-buttons.php
62 lines (55 loc) · 1.53 KB
/
blissful-buttons.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
57
58
59
60
61
62
<?php
/**
* Plugin Name: Blissful Buttons
* Plugin URI: https://sortabrilliant.com/blissfulbuttons
* Description: Boring buttons don't get clicked.
* Version: 1.0.2
* Requires at least: 5.0
* Requires PHP: 5.6
* Author: sorta brilliant
* Author URI: https://sortabrilliant.com/
* License: GPL-2.0-or-later
* License URI: http://www.gnu.org/licenses/gpl-2.0.txt
*
* @package blissful-buttons
*/
namespace SortaBrilliant\BlissfulButtons;
/**
* Registers the block and required assets.
*
* @return void
*/
function register_block() {
if ( ! function_exists( 'register_block_type' ) ) {
return;
}
$asset_filepath = __DIR__ . '/build/index.asset.php';
$asset_file = file_exists( $asset_filepath ) ? include $asset_filepath : [
'dependencies' => [],
'version' => false,
];
wp_register_script(
'blissful-buttons',
plugins_url( 'build/index.js', __FILE__ ),
$asset_file['dependencies'],
$asset_file['version']
);
wp_register_style(
'blissful-buttons-editor-style',
plugins_url( 'build/editor.css', __FILE__ ),
[],
$asset_file['version']
);
wp_register_style(
'blissful-buttons-style',
plugins_url( 'build/style.css', __FILE__ ),
[],
$asset_file['version']
);
register_block_type( 'sortabrilliant/blissful-buttons', [
'editor_script' => 'blissful-buttons',
'editor_style' => 'blissful-buttons-editor-style',
'style' => 'blissful-buttons-style',
] );
}
add_action( 'init', __NAMESPACE__ . '\\register_block' );