-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathnewsletter-block.php
85 lines (72 loc) · 2.08 KB
/
newsletter-block.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
<?php
/**
* Plugin Name: Newsletter Block
* Description: Create a customizable newsletter subscription form with an email input field and submit button in the WordPress editor.
* Requires at least: 6.6
* Requires PHP: 7.2
* Version: 1.0.0
* Author: DevPress
* License: GPL-2.0-or-later
* License URI: https://www.gnu.org/licenses/gpl-2.0.html
* Text Domain: newsletter-block
*
* @package devpress
*/
if ( ! defined( 'ABSPATH' ) ) {
exit; // Exit if accessed directly.
}
/**
* Registers all block assets so that they can be enqueued through the block editor
* in the corresponding context.
*/
function devpress_newsletter_block_block_init() {
$dir = __DIR__;
$index_js = 'index.js';
wp_register_script(
'devpress-newsletter-block-block-editor',
plugins_url( $index_js, __FILE__ ),
array(
'wp-block-editor',
'wp-blocks',
'wp-i18n',
'wp-element',
),
filemtime( "$dir/$index_js" )
);
wp_set_script_translations( 'devpress-newsletter-block-block-editor', 'newsletter-block' );
$editor_css = 'editor.css';
wp_register_style(
'devpress-newsletter-block-block-editor',
plugins_url( $editor_css, __FILE__ ),
array(),
filemtime( "$dir/$editor_css" )
);
$style_css = 'style.css';
wp_register_style(
'devpress-newsletter-block-block',
plugins_url( $style_css, __FILE__ ),
array(),
filemtime( "$dir/$style_css" )
);
register_block_type(
$dir,
array(
'editor_script' => 'devpress-newsletter-block-block-editor',
'editor_style' => 'devpress-newsletter-block-block-editor',
'style' => 'devpress-newsletter-block-block',
)
);
}
add_action( 'init', 'devpress_newsletter_block_block_init' );
include_once plugin_dir_path( __FILE__ ) . 'includes/LeadsCpt.php';
if ( class_exists( 'LeadsCPT' ) ) {
new LeadsCPT();
}
include_once plugin_dir_path( __FILE__ ) . 'includes/StagesTax.php';
if ( class_exists( 'StagesTax' ) ) {
new StagesTax();
}
include_once plugin_dir_path( __FILE__ ) . 'includes/LeadsCF.php';
if ( class_exists( 'LeadsCF' ) ) {
new LeadsCF();
}