-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathfectionwp-blocks.php
More file actions
101 lines (91 loc) · 2.97 KB
/
Copy pathfectionwp-blocks.php
File metadata and controls
101 lines (91 loc) · 2.97 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
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
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
<?php
/**
* Plugin Name: FectionWP Blocks
* Plugin URI: https://fectionlabs.com/fectionwp-blocks
* Description: Bootstrap 5 Gutenberg blocks en page sections voor FectionWP Pro theme. Inclusief heroes, features, testimonials, pricing en meer.
* Version: 1.0.0
* Author: FectionLabs
* Author URI: https://fectionlabs.com
* License: GPL v2 or later
* License URI: https://www.gnu.org/licenses/gpl-2.0.html
* Text Domain: fectionwp-blocks
* Domain Path: /languages
* Requires PHP: 7.4
* Requires at least: 6.0
*/
if ( ! defined( 'ABSPATH' ) ) {
exit; // Exit if accessed directly
}
// Define plugin constants
define( 'FWP_BLOCKS_VERSION', '1.0.0' );
define( 'FWP_BLOCKS_PLUGIN_DIR', plugin_dir_path( __FILE__ ) );
define( 'FWP_BLOCKS_PLUGIN_URL', plugin_dir_url( __FILE__ ) );
define( 'FWP_BLOCKS_PLUGIN_FILE', __FILE__ );
/**
* Check if FectionWP Pro theme is active
*/
function fwp_blocks_check_theme() {
$theme = wp_get_theme();
$theme_name = $theme->get( 'Name' );
$parent_theme = $theme->parent() ? $theme->parent()->get( 'Name' ) : '';
if ( $theme_name !== 'FectionWP Pro' && $parent_theme !== 'FectionWP Pro' ) {
add_action( 'admin_notices', 'fwp_blocks_theme_notice' );
return false;
}
return true;
}
/**
* Show admin notice if theme is not active
*/
function fwp_blocks_theme_notice() {
?>
<div class="notice notice-warning">
<p>
<strong><?php esc_html_e( 'FectionWP Blocks', 'fectionwp-blocks' ); ?></strong>
<?php esc_html_e( ' vereist het FectionWP Pro thema om optimaal te werken.', 'fectionwp-blocks' ); ?>
</p>
</div>
<?php
}
// Load plugin components
require_once FWP_BLOCKS_PLUGIN_DIR . 'includes/gutenberg-blocks.php';
require_once FWP_BLOCKS_PLUGIN_DIR . 'includes/page-sections.php';
/**
* Load plugin textdomain
*/
function fwp_blocks_load_textdomain() {
load_plugin_textdomain(
'fectionwp-blocks',
false,
dirname( plugin_basename( __FILE__ ) ) . '/languages'
);
}
add_action( 'plugins_loaded', 'fwp_blocks_load_textdomain' );
/**
* Activation hook
*/
function fwp_blocks_activate() {
// Check WordPress version
if ( version_compare( get_bloginfo( 'version' ), '6.0', '<' ) ) {
deactivate_plugins( plugin_basename( __FILE__ ) );
wp_die(
esc_html__( 'Deze plugin vereist WordPress 6.0 of hoger.', 'fectionwp-blocks' ),
esc_html__( 'Plugin Activatie Fout', 'fectionwp-blocks' )
);
}
// Check PHP version
if ( version_compare( PHP_VERSION, '7.4', '<' ) ) {
deactivate_plugins( plugin_basename( __FILE__ ) );
wp_die(
esc_html__( 'Deze plugin vereist PHP 7.4 of hoger.', 'fectionwp-blocks' ),
esc_html__( 'Plugin Activatie Fout', 'fectionwp-blocks' )
);
}
}
register_activation_hook( __FILE__, 'fwp_blocks_activate' );
/**
* Check theme compatibility
*/
if ( ! fwp_blocks_check_theme() ) {
// Still load blocks but show warning
}