|
1
|
|
|
<?php |
|
2
|
|
|
if ( ! defined( 'ABSPATH' ) ) return; // Exit if accessed directly |
|
3
|
|
|
|
|
4
|
|
|
|
|
5
|
|
|
if ( ! function_exists( 'lsx_activation_admin_notice' ) ) : |
|
6
|
|
|
/** |
|
7
|
|
|
* Adds an admin notice upon successful activation. |
|
8
|
|
|
* |
|
9
|
|
|
* @since 1.8.0 |
|
10
|
|
|
* @package lsx |
|
11
|
|
|
*/ |
|
12
|
|
|
function lsx_activation_admin_notice() { |
|
13
|
|
|
global $pagenow; |
|
14
|
|
|
|
|
15
|
|
|
if ( is_admin() && 'themes.php' == $pagenow && isset( $_GET['activated'] ) ) { |
|
16
|
|
|
add_action( 'admin_notices', 'lsx_welcome_admin_notice', 99 ); |
|
17
|
|
|
} |
|
18
|
|
|
} |
|
19
|
|
|
endif; // lsx_activation_admin_notice |
|
20
|
|
|
add_action( 'load-themes.php', 'lsx_activation_admin_notice' ); |
|
21
|
|
|
|
|
22
|
|
|
|
|
23
|
|
|
if ( ! function_exists( 'lsx_welcome_admin_notice' ) ) : |
|
24
|
|
|
/** |
|
25
|
|
|
* Display an admin notice linking to the welcome screen. |
|
26
|
|
|
* |
|
27
|
|
|
* @since 1.8.0 |
|
28
|
|
|
* @package lsx |
|
29
|
|
|
*/ |
|
30
|
|
|
function lsx_welcome_admin_notice() { |
|
31
|
|
|
?> |
|
32
|
|
|
<div class="updated notice is-dismissible"> |
|
33
|
|
|
<p><?php echo sprintf( esc_html__( 'Thanks for choosing LSX! You can read hints and tips on how get the most out of your new theme on the %swelcome screen%s.', 'lsx' ), '<a href="' . esc_url( admin_url( 'themes.php?page=lsx-welcome' ) ) . '">', '</a>' ); ?></p> |
|
34
|
|
|
<p><a href="<?php echo esc_url( admin_url( 'themes.php?page=lsx-welcome' ) ); ?>" class="button" style="text-decoration: none;"><?php esc_attr_e( 'Get started with LSX', 'lsx' ); ?></a></p> |
|
35
|
|
|
</div> |
|
36
|
|
|
<?php |
|
37
|
|
|
} |
|
38
|
|
|
endif; // lsx_welcome_admin_notice |
|
39
|
|
|
|
|
40
|
|
|
|
|
41
|
|
|
if ( ! function_exists( 'lsx_welcome_style' ) ) : |
|
42
|
|
|
/** |
|
43
|
|
|
* Load welcome screen css. |
|
44
|
|
|
* |
|
45
|
|
|
* @param string $hook_suffix the current page hook suffix. |
|
46
|
|
|
* @since 1.8.0 |
|
47
|
|
|
* @package lsx |
|
48
|
|
|
*/ |
|
49
|
|
|
function lsx_welcome_style( $hook_suffix ) { |
|
50
|
|
|
if ( 'appearance_page_lsx-welcome' == $hook_suffix ) { |
|
51
|
|
|
wp_enqueue_style( 'lsx-welcome-screen', get_template_directory_uri() . '/css/admin/welcome-screen/welcome.css', array(), LSX_VERSION ); |
|
52
|
|
|
} |
|
53
|
|
|
} |
|
54
|
|
|
endif; // lsx_welcome_style |
|
55
|
|
|
add_action( 'admin_enqueue_scripts', 'lsx_welcome_style' ); |
|
56
|
|
|
|
|
57
|
|
|
|
|
58
|
|
|
if ( ! function_exists( 'lsx_welcome_register_menu' ) ) : |
|
59
|
|
|
/** |
|
60
|
|
|
* Creates the dashboard page. |
|
61
|
|
|
* |
|
62
|
|
|
* @since 1.8.0 |
|
63
|
|
|
* @package lsx |
|
64
|
|
|
*/ |
|
65
|
|
|
function lsx_welcome_register_menu() { |
|
66
|
|
|
add_theme_page( 'LSX', 'LSX', 'activate_plugins', 'lsx-welcome', 'lsx_welcome_screen' ); |
|
67
|
|
|
} |
|
68
|
|
|
endif; // lsx_welcome_register_menu |
|
69
|
|
|
add_action( 'admin_menu', 'lsx_welcome_register_menu' ); |
|
70
|
|
|
|
|
71
|
|
|
|
|
72
|
|
|
if ( ! function_exists( 'lsx_welcome_screen' ) ) : |
|
73
|
|
|
/** |
|
74
|
|
|
* The welcome screen. |
|
75
|
|
|
* |
|
76
|
|
|
* @since 1.8.0 |
|
77
|
|
|
* @package lsx |
|
78
|
|
|
*/ |
|
79
|
|
|
function lsx_welcome_screen() { |
|
80
|
|
|
require_once( ABSPATH . 'wp-load.php' ); |
|
81
|
|
|
require_once( ABSPATH . 'wp-admin/admin.php' ); |
|
82
|
|
|
require_once( ABSPATH . 'wp-admin/admin-header.php' ); |
|
83
|
|
|
?> |
|
84
|
|
|
<div class="wrap about-wrap"> |
|
85
|
|
|
<?php |
|
86
|
|
|
/** |
|
87
|
|
|
* Functions hooked into lsx_welcome action |
|
88
|
|
|
* |
|
89
|
|
|
* @hooked lsx_welcome_header - 10 |
|
90
|
|
|
* @hooked lsx_welcome_enhance - 20 |
|
91
|
|
|
* @hooked lsx_welcome_footer - 30 |
|
92
|
|
|
*/ |
|
93
|
|
|
do_action( 'lsx_welcome' ); ?> |
|
94
|
|
|
</div> |
|
95
|
|
|
<?php |
|
96
|
|
|
} |
|
97
|
|
|
endif; // lsx_welcome_screen |
|
98
|
|
|
|
|
99
|
|
|
|
|
100
|
|
|
if ( ! function_exists( 'lsx_welcome_header' ) ) : |
|
101
|
|
|
/** |
|
102
|
|
|
* Welcome screen intro |
|
103
|
|
|
* |
|
104
|
|
|
* @since 1.8.0 |
|
105
|
|
|
* @package lsx |
|
106
|
|
|
*/ |
|
107
|
|
|
function lsx_welcome_header() { |
|
108
|
|
|
require_once( get_template_directory() . '/inc/admin/welcome-screen/component-header.php' ); |
|
109
|
|
|
} |
|
110
|
|
|
endif; // lsx_welcome_header |
|
111
|
|
|
add_action( 'lsx_welcome', 'lsx_welcome_header', 10 ); |
|
112
|
|
|
|
|
113
|
|
|
|
|
114
|
|
|
if ( ! function_exists( 'lsx_welcome_enhance' ) ) : |
|
115
|
|
|
/** |
|
116
|
|
|
* Welcome screen enhance section |
|
117
|
|
|
* |
|
118
|
|
|
* @since 1.8.0 |
|
119
|
|
|
* @package lsx |
|
120
|
|
|
*/ |
|
121
|
|
|
function lsx_welcome_enhance() { |
|
122
|
|
|
require_once( get_template_directory() . '/inc/admin/welcome-screen/component-enhance.php' ); |
|
123
|
|
|
} |
|
124
|
|
|
endif; // lsx_welcome_enhance |
|
125
|
|
|
add_action( 'lsx_welcome', 'lsx_welcome_enhance', 20 ); |
|
126
|
|
|
|
|
127
|
|
|
|
|
128
|
|
|
if ( ! function_exists( 'lsx_welcome_footer' ) ) : |
|
129
|
|
|
/** |
|
130
|
|
|
* Welcome screen contribute section |
|
131
|
|
|
* |
|
132
|
|
|
* @since 1.8.0 |
|
133
|
|
|
* @package lsx |
|
134
|
|
|
*/ |
|
135
|
|
|
function lsx_welcome_footer() { |
|
136
|
|
|
require_once( get_template_directory() . '/inc/admin/welcome-screen/component-footer.php' ); |
|
137
|
|
|
} |
|
138
|
|
|
endif; // lsx_welcome_footer |
|
139
|
|
|
add_action( 'lsx_welcome', 'lsx_welcome_footer', 30 ); |
|
140
|
|
|
|