-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathhm-split-background.php
More file actions
45 lines (36 loc) · 1.13 KB
/
hm-split-background.php
File metadata and controls
45 lines (36 loc) · 1.13 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
<?php
/**
* Plugin Name: HM Split Background
* Description: Adds a "Split Background" panel to the core/group block, enabling a hard-edge vertical gradient without manual CSS.
* Version: __VERSION__
* Requires at least: 6.5
* Requires PHP: 8.0
* Author: Human Made Limited
* Author URI: https://humanmade.com
* License: GPL-2.0-or-later
* License URI: https://www.gnu.org/licenses/gpl-2.0.html
* Text Domain: hm-split-background
*/
namespace HM\SplitBackground;
if ( ! defined( 'ABSPATH' ) ) {
exit;
}
const VERSION = '__VERSION__';
function bootstrap() : void {
add_action( 'enqueue_block_editor_assets', __NAMESPACE__ . '\\enqueue_editor_assets' );
}
function enqueue_editor_assets() : void {
$asset_file = plugin_dir_path( __FILE__ ) . 'build/index.asset.php';
if ( ! file_exists( $asset_file ) ) {
return;
}
$asset = require $asset_file;
wp_enqueue_script(
'hm-split-background-editor',
plugin_dir_url( __FILE__ ) . 'build/index.js',
$asset['dependencies'],
$asset['version'],
true
);
}
add_action( 'plugins_loaded', __NAMESPACE__ . '\\bootstrap' );