PluginProbe
Sticky Block for Gutenberg Editor / trunk
Sticky Block for Gutenberg Editor vtrunk
trunk 1.11 1.11.1
sticky-block / src / init.php

init.php in Sticky Block for Gutenberg Editor trunk, at src/init.php

60 lines 1.3 KB
No matching file
Up and down to move Enter to open Esc to close
Raw Download Zip
1 <?php
2
3 if ( ! defined( 'ABSPATH' ) ) {
4 exit;
5 }
6
7 function sticky_block_assets() {
8 wp_register_script(
9 'sticky_block-editor-js',
10 plugins_url( 'dist/blocks.build.js', dirname( __FILE__ ) ),
11 array( 'wp-blocks', 'wp-i18n', 'wp-element', 'wp-editor' ),
12 '1.11.1',
13 array( 'in_footer' => true )
14 );
15
16 wp_register_style(
17 'sticky_block-css',
18 plugins_url( 'dist/blocks.style.build.css', dirname( __FILE__ ) ),
19 array( 'wp-editor' ),
20 '1.11.1'
21 );
22
23 wp_register_style(
24 'sticky_block-editor-css',
25 plugins_url( 'dist/blocks.editor.build.css', dirname( __FILE__ ) ),
26 array( 'wp-edit-blocks' ),
27 '1.11.1'
28 );
29
30 wp_localize_script(
31 'sticky_block-editor-js',
32 'cgbGlobal',
33 [
34 'pluginDirPath' => plugin_dir_path( __DIR__ ),
35 'pluginDirUrl' => plugin_dir_url( __DIR__ ),
36 ]
37 );
38
39 register_block_type(
40 'senff/sticky-block', array(
41 'editor_script' => 'sticky_block-editor-js',
42 'style' => 'sticky_block-css',
43 'editor_style' => 'sticky_block-editor-css',
44 )
45 );
46 }
47
48 function sticky_block_frontend() {
49 wp_register_script(
50 'sticky_block-js',
51 plugins_url('dist/sticky-block.min.js', dirname( __FILE__ )),
52 array( 'jquery' ),
53 "1.0",
54 true
55 );
56 wp_enqueue_script('sticky_block-js');
57 }
58
59 add_action( 'init', 'sticky_block_assets' );
60 add_action('wp_enqueue_scripts', 'sticky_block_frontend');