-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathwpenq-settings.php
38 lines (30 loc) · 1.14 KB
/
wpenq-settings.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
<?php
// create options page menu
function wpenq_create_menu() {
global $wpenq_page;
// generate wp-enqueue menu
$wpenq_page = add_options_page('WP Enqueue', 'WP Enqueue', 'manage_options', 'wpenq-menu', 'wpenq_menu');
// activate custom settings
add_action('admin_init', 'wpenq_custom_settings');
}
add_action('admin_menu', 'wpenq_create_menu');
function wpenq_custom_settings() {
/* Register settings */
register_setting('wpenq-settings-group', 'wpenq_scripts_path');
register_setting('wpenq-settings-group', 'wpenq_scripts_cond');
register_setting('wpenq-settings-group', 'wpenq_styles_path');
register_setting('wpenq-settings-group', 'wpenq_styles_cond');
/* Add sections */
add_settings_section('wpenq-scripts', 'WP Enqueue Scripts', 'wpenq_scripts', 'wpenq-menu');
add_settings_section('wpenq-styles', 'WP Enqueue Styles', 'wpenq_styles', 'wpenq-menu');
}
/* callback functions with content */
function wpenq_menu() {
require_once('templates/menu.php');
}
function wpenq_scripts() {
require_once('templates/scripts.php');
}
function wpenq_styles() {
require_once('templates/styles.php');
}