-
Notifications
You must be signed in to change notification settings - Fork 0
/
sunshine-companion.php
76 lines (59 loc) · 2.35 KB
/
sunshine-companion.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
<?php
/*
* Plugin Name: Sunshine Companion
* Plugin URI: https://colorlib.com/wp/themes/sunshine/
* Description: Sunshine Companion is a companion for Sunshine theme.
* Version: 1.0.1
* Author: Colorlib
* Author URI: https://colorlib.com/
* License: GPL-2.0+
* License URI: http://www.gnu.org/licenses/gpl-2.0.txt
* Text Domain: sunshine-companion
* Domain Path: /languages
*/
if( !defined( 'WPINC' ) ){
die;
}
/*************************
Define Constant
*************************/
// Define version constant
if( !defined( 'SUNSHINE_COMPANION_VERSION' ) ){
define( 'SUNSHINE_COMPANION_VERSION', '1.1' );
}
// Define dir path constant
if( !defined( 'SUNSHINE_COMPANION_DIR_PATH' ) ){
define( 'SUNSHINE_COMPANION_DIR_PATH', plugin_dir_path( __FILE__ ) );
}
// Define inc dir path constant
if( !defined( 'SUNSHINE_COMPANION_INC_DIR_PATH' ) ){
define( 'SUNSHINE_COMPANION_INC_DIR_PATH', SUNSHINE_COMPANION_DIR_PATH.'inc/' );
}
// Define sidebar widgets dir path constant
if( !defined( 'SUNSHINE_COMPANION_SW_DIR_PATH' ) ){
define( 'SUNSHINE_COMPANION_SW_DIR_PATH', SUNSHINE_COMPANION_INC_DIR_PATH.'sidebar-widgets/' );
}
// Define elementor widgets dir path constant
if( !defined( 'SUNSHINE_COMPANION_EW_DIR_PATH' ) ){
define( 'SUNSHINE_COMPANION_EW_DIR_PATH', SUNSHINE_COMPANION_INC_DIR_PATH.'elementor-widgets/' );
}
// Define demo data dir path constant
if( !defined( 'SUNSHINE_COMPANION_DEMO_DIR_PATH' ) ){
define( 'SUNSHINE_COMPANION_DEMO_DIR_PATH', SUNSHINE_COMPANION_INC_DIR_PATH.'demo-data/' );
}
$current_theme = wp_get_theme();
$is_parent = $current_theme->parent();
if( ( 'Sunshine' == $current_theme->get( 'Name' ) ) || ( $is_parent && 'Sunshine' == $is_parent->get( 'Name' ) ) ){
require_once SUNSHINE_COMPANION_DIR_PATH . 'sunshine-init.php';
}else{
add_action( 'admin_notices', 'sunshine_companion_admin_notice', 99 );
function sunshine_companion_admin_notice() {
$url = 'https://demo.colorlib.com/sunshine/';
?>
<div class="notice-warning notice">
<p><?php printf( __( 'In order to use the <strong>Sunshine Companion</strong> plugin you have to also install the %1$sSunshine Theme%2$s', 'sunshine-companion' ), '<a href="'.esc_url( $url ).'" target="_blank">', '</a>' ); ?></p>
</div>
<?php
}
}
?>