-
Notifications
You must be signed in to change notification settings - Fork 2
/
gutenberg-starter.php
54 lines (49 loc) · 1.21 KB
/
gutenberg-starter.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
<?php
/**
* Plugin Name: Gutenberg Starter
* Description: Starter extension for creating gutenberg based plugins.
* Requires at least: 5.8
* Requires PHP: 7.0
* Version: 0.1.0
* Author: Gutenberghub
* License: GPL-2.0-or-later
* License URI: https://www.gnu.org/licenses/gpl-2.0.html
* Text Domain: gutenberg-starter
*
*/
define( 'STARTER_PLUGIN_URL', plugins_url( '/', __FILE__ ) );
add_action('init', function() {
wp_register_script(
"starter-plugin-script",
STARTER_PLUGIN_URL . '/build/index.js',
array(
"wp-element",
"wp-compose",
"wp-hooks",
"wp-block-editor",
"wp-i18n"
),
'initial'
);
wp_register_style(
'starter-plugin-editor-style',
STARTER_PLUGIN_URL . '/build/index.css',
array(),
'initial'
);
wp_register_style(
'starter-plugin-frontend-style',
STARTER_PLUGIN_URL . '/build/style-index.css',
array(),
'initial'
);
} );
add_action( 'enqueue_block_editor_assets', function () {
wp_enqueue_script( 'starter-plugin-script' );
wp_enqueue_style( 'starter-plugin-editor-style' );
} );
add_action( 'init', function () {
if ( ! is_admin() ) {
wp_enqueue_style( 'starter-plugin-frontend-style' );
}
} );