-
Notifications
You must be signed in to change notification settings - Fork 0
/
settings_functions.php
103 lines (88 loc) · 2.51 KB
/
settings_functions.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
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
<?php
/**
* @package admin-bar-colorize
*/
add_action( 'admin_menu', 'admin_bar_colorize_admin_menu' );
add_action( 'admin_init', 'admin_bar_colorize_settings_init' );
function admin_bar_colorize_admin_menu()
{
add_options_page(
__('Admin Bar Colorize', 'admin-bar-colorize' ),
__('Admin Bar Colorize', 'admin-bar-colorize' ),
'manage_options',
'admin-bar-colorize',
'admin_bar_colorize_options_page'
);
}
function admin_bar_colorize_settings_init()
{
register_setting( 'admin_bar_colorize_pluginPage', 'admin_bar_colorize_settings' );
add_settings_section(
'admin_bar_colorize_pluginPage_section',
__('Choice colors', 'admin-bar-colorize' ),
'admin_bar_colorize_settings_section_callback',
'admin_bar_colorize_pluginPage'
);
add_settings_field(
'admin_bar_colorize_primary_color',
__('Primary color', 'admin-bar-colorize'),
'admin_bar_colorize_primary_color_render',
'admin_bar_colorize_pluginPage',
'admin_bar_colorize_pluginPage_section'
);
add_settings_field(
'admin_bar_colorize_secondary_color',
__('Secondary color', 'admin-bar-colorize'),
'admin_bar_colorize_secondary_color_render',
'admin_bar_colorize_pluginPage',
'admin_bar_colorize_pluginPage_section'
);
add_settings_field(
'admin_bar_colorize_text_color',
__('Text color', 'admin-bar-colorize'),
'admin_bar_colorize_text_color_render',
'admin_bar_colorize_pluginPage',
'admin_bar_colorize_pluginPage_section'
);
add_settings_field(
'admin_bar_colorize_highlight_color',
__('Highlight color', 'admin-bar-colorize'),
'admin_bar_colorize_highlight_color_render',
'admin_bar_colorize_pluginPage',
'admin_bar_colorize_pluginPage_section'
);
}
function admin_bar_colorize_primary_color_render()
{
admin_bar_colorize_input_render('primary');
}
function admin_bar_colorize_secondary_color_render()
{
admin_bar_colorize_input_render('secondary');
}
function admin_bar_colorize_text_color_render()
{
admin_bar_colorize_input_render('text');
}
function admin_bar_colorize_highlight_color_render()
{
admin_bar_colorize_input_render('highlight');
}
function admin_bar_colorize_settings_section_callback()
{
echo __('Select the appropriate color and click "Save."', 'admin-bar-colorize' );
}
function admin_bar_colorize_options_page()
{
?>
<form action='options.php' method='post'>
<h1><?php _e('Admin Bar Colorize', 'admin-bar-colorize' ); ?></h1>
<?php
settings_fields( 'admin_bar_colorize_pluginPage' );
do_settings_sections( 'admin_bar_colorize_pluginPage' );
submit_button();
?>
</form>
<?php
}
?>