-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathplugin.php
86 lines (77 loc) · 2.05 KB
/
plugin.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
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
<?php
/*
Plugin Name: GT Remove Block Spacing
Plugin URI: https://germanthemes.de/en/plugins/gt-remove-block-spacing/
Description: Remove top and bottom spacing for any Gutenberg block.
Author: GermanThemes
Author URI: https://germanthemes.de/en/
Version: 1.0
Text Domain: gt-remove-block-spacing
Domain Path: /languages/
License: GNU General Public License v2 or later
License URI: http://www.gnu.org/licenses/gpl-2.0.html
GT Remove Block Spacing
Copyright(C) 2020, germanthemes.de - [email protected]
*/
// Exit if accessed directly.
if ( ! defined( 'ABSPATH' ) ) {
exit;
}
/**
* Main GermanThemes_Remove_Block_Spacing Class
*
* @package GT Remove Block Spacing
*/
class GermanThemes_Remove_Block_Spacing {
/**
* Setup the Plugin
*
* @return void
*/
static function setup() {
// Enqueue Block Styles.
add_action( 'enqueue_block_assets', array( __CLASS__, 'enqueue_block_scripts' ) );
// Enqueue Block Scripts and Styles for Gutenberg Editor.
add_action( 'enqueue_block_editor_assets', array( __CLASS__, 'enqueue_block_editor_scripts' ) );
}
/**
* Enqueue Block Styles
*
* Used in Frontend and Backend
*
* @return void
*/
static function enqueue_block_scripts() {
wp_enqueue_style(
'gt-remove-block-spacing',
plugins_url( 'assets/css/gt-remove-block-spacing.css', __FILE__ ),
array(),
'20200505'
);
}
/**
* Enqueue Scripts and Styles for Blocks
*
* Used in Backend in Gutenberg Editor only
*
* @return void
*/
static function enqueue_block_editor_scripts() {
// Enqueue GT Remove Block Spacing in Gutenberg.
wp_enqueue_script(
'gt-remove-block-spacing',
plugins_url( 'assets/js/gt-remove-block-spacing.js', __FILE__ ),
array( 'wp-blocks', 'wp-i18n', 'wp-element', 'wp-editor' ),
'20200505'
);
// Enqueue Editor Stylesheet for GT Remove Block Spacing.
wp_enqueue_style(
'gt-remove-block-spacing-editor',
plugins_url( 'assets/css/gt-remove-block-spacing-editor.css', __FILE__ ),
array( 'wp-edit-blocks' ),
'20200505'
);
}
}
// Run Plugin.
GermanThemes_Remove_Block_Spacing::setup();