PluginProbe
WpStream – Live Streaming, Video on Demand, Pay Per View / 4.8
WpStream – Live Streaming, Video on Demand, Pay Per View v4.8
4.14.1 4.14.0 4.13.2 4.13.1 4.13 4.12.5 4.12.4 4.12.3 4.12.2 4.12.1 4.12 4.4.4 4.4.5 4.4.6 4.4.7 4.4.8 4.4.9 4.5 4.5.1 4.5.11 4.5.11.1 4.5.11.2 4.5.11.4 4.5.11.5 4.5.11.6 All 181 releases
wpstream / hello-wpstream / framework / customizer-settings / customizer-button-settings.php

customizer-button-settings.php in WpStream – Live Streaming, Video on Demand, Pay Per View 4.8, at hello-wpstream/framework/customizer-settings/customizer-button-settings.php

232 lines 6.7 KB
No matching file
Up and down to move Enter to open Esc to close
Raw Download Zip
1 <?php
2 /**
3 * Customizer Button Settings
4 *
5 * @package wpstream-theme
6 */
7
8 /**
9 * Function to add button color settings and controls
10 *
11 * @param WP_Customize_Manager $wp_customize
12 * @param string $button_type
13 */
14 function wpstream_add_button_color_settings($wp_customize, $button_type) {
15 $button_type_label = ucwords(str_replace('_', ' ', $button_type));
16
17 // Add section for buttons colors
18 $wp_customize->add_control(
19 new Wpstream_Title_Control(
20 $wp_customize,
21 array(
22 'label' => esc_html__( $button_type_label . ' button style', 'hello-wpstream' ),
23 'section' => 'wpstream_buttons_colors',
24 )
25 )
26 );
27
28 // Add text color option
29 wpstream_add_color_control($wp_customize, $button_type, 'button_text_color', 'Text color');
30
31 // Add option to switch between simple and gradient for background color
32 wpstream_add_background_option_control($wp_customize, $button_type, 'button_background', 'Background color');
33
34 // Add simple background color option
35 wpstream_add_color_control($wp_customize, $button_type, 'button_background_color_option_simple', 'Background color');
36
37 // Add gradient options for background color
38 wpstream_add_gradient_controls($wp_customize, $button_type, 'button_background_color_gradient');
39
40 // Add option to switch between simple and gradient for hover background color
41 wpstream_add_background_option_control($wp_customize, $button_type, 'button_hover_background', 'Hover Background color');
42
43 // Add simple hover background color option
44 wpstream_add_color_control($wp_customize, $button_type, 'button_hover_background_color_option_simple', 'Hover Background color');
45
46 // Add gradient options for hover background color
47 wpstream_add_gradient_controls($wp_customize, $button_type, 'button_hover_background_color_gradient');
48
49 // Add border options
50 wpstream_add_border_control($wp_customize, $button_type, 'button_border');
51
52 // Add opacity option
53 wpstream_add_opacity_control($wp_customize, $button_type, 'button');
54 }
55
56 function wpstream_add_color_control($wp_customize, $button_type, $setting_name, $label) {
57 $wp_customize->add_setting(
58 "wpstream_{$button_type}_{$setting_name}",
59 array(
60 'default' => '',
61 'sanitize_callback' => 'sanitize_hex_color',
62 )
63 );
64 $wp_customize->add_control(
65 new WP_Customize_Color_Control(
66 $wp_customize,
67 "wpstream_{$button_type}_{$setting_name}",
68 array(
69 'label' => esc_html__( $label, 'hello-wpstream' ),
70 'section' => 'wpstream_buttons_colors',
71 'settings' => "wpstream_{$button_type}_{$setting_name}",
72 )
73 )
74 );
75 }
76
77 function wpstream_add_background_option_control($wp_customize, $button_type, $setting_name, $label) {
78 $wp_customize->add_setting(
79 "wpstream_{$button_type}_{$setting_name}_option",
80 array(
81 'default' => 'simple',
82 'sanitize_callback' => 'sanitize_text_field',
83 )
84 );
85 $wp_customize->add_control(
86 "wpstream_{$button_type}_{$setting_name}_option",
87 array(
88 'label' => esc_html__( $label, 'hello-wpstream' ),
89 'type' => 'radio',
90 'section' => 'wpstream_buttons_colors',
91 'choices' => array(
92 'simple' => __( 'Simple color', 'hello-wpstream' ),
93 'gradient' => __( 'Gradient color', 'hello-wpstream' ),
94 ),
95 )
96 );
97 }
98
99 function wpstream_add_gradient_controls($wp_customize, $button_type, $setting_name) {
100 $wp_customize->add_setting(
101 "wpstream_{$button_type}_{$setting_name}_angle",
102 array(
103 'default' => 0,
104 'sanitize_callback' => 'wpstream_sanitize_number_field',
105 )
106 );
107 $wp_customize->add_control(
108 new Wpstream_Range_Control(
109 $wp_customize,
110 "wpstream_{$button_type}_{$setting_name}_angle",
111 array(
112 'label' => esc_html__( 'Gradient angle', 'hello-wpstream' ),
113 'section' => 'wpstream_buttons_colors',
114 'min' => 0,
115 'max' => 360,
116 'step' => 1,
117 'unit' => 'deg',
118 )
119 )
120 );
121
122 wpstream_add_color_control($wp_customize, $button_type, "{$setting_name}_first_color", 'First color');
123 wpstream_add_color_control($wp_customize, $button_type, "{$setting_name}_second_color", 'Second color');
124 }
125
126 function wpstream_add_border_control($wp_customize, $button_type, $setting_name) {
127 $wp_customize->add_setting(
128 "wpstream_{$button_type}_{$setting_name}_width",
129 array(
130 'default' => 0,
131 'sanitize_callback' => 'wpstream_sanitize_number_field',
132 )
133 );
134 $wp_customize->add_control(
135 new Wpstream_Range_Control(
136 $wp_customize,
137 "wpstream_{$button_type}_{$setting_name}_width",
138 array(
139 'label' => esc_html__( 'Border width', 'hello-wpstream' ),
140 'section' => 'wpstream_buttons_colors',
141 'min' => 0,
142 'max' => 20,
143 'step' => 1,
144 'unit' => 'px',
145 )
146 )
147 );
148
149 $wp_customize->add_setting(
150 "wpstream_{$button_type}_{$setting_name}_color",
151 array(
152 'default' => '',
153 'sanitize_callback' => 'sanitize_hex_color',
154 )
155 );
156 $wp_customize->add_control(
157 new WP_Customize_Color_Control(
158 $wp_customize,
159 "wpstream_{$button_type}_{$setting_name}_color",
160 array(
161 'label' => esc_html__( 'Border color', 'hello-wpstream' ),
162 'section' => 'wpstream_buttons_colors',
163 'settings' => "wpstream_{$button_type}_{$setting_name}_color",
164 )
165 )
166 );
167
168 $wp_customize->add_setting(
169 "wpstream_{$button_type}_{$setting_name}_hover_color",
170 array(
171 'default' => '',
172 'sanitize_callback' => 'sanitize_hex_color',
173 )
174 );
175 $wp_customize->add_control(
176 new WP_Customize_Color_Control(
177 $wp_customize,
178 "wpstream_{$button_type}_{$setting_name}_hover_color",
179 array(
180 'label' => esc_html__( 'Hover border color', 'hello-wpstream' ),
181 'section' => 'wpstream_buttons_colors',
182 'settings' => "wpstream_{$button_type}_{$setting_name}_hover_color",
183 )
184 )
185 );
186
187 $wp_customize->add_setting(
188 "wpstream_{$button_type}_{$setting_name}_radius",
189 array(
190 'default' => 0,
191 'sanitize_callback' => 'wpstream_sanitize_number_field',
192 )
193 );
194 $wp_customize->add_control(
195 new Wpstream_Range_Control(
196 $wp_customize,
197 "wpstream_{$button_type}_{$setting_name}_radius",
198 array(
199 'label' => esc_html__( 'Border radius', 'hello-wpstream' ),
200 'section' => 'wpstream_buttons_colors',
201 'min' => 0,
202 'max' => 50,
203 'step' => 1,
204 'unit' => 'px',
205 )
206 )
207 );
208 }
209
210 function wpstream_add_opacity_control($wp_customize, $button_type, $setting_name) {
211 $wp_customize->add_setting(
212 "wpstream_{$button_type}_{$setting_name}_opacity",
213 array(
214 'default' => 100,
215 'sanitize_callback' => 'wpstream_sanitize_number_field',
216 )
217 );
218 $wp_customize->add_control(
219 new Wpstream_Range_Control(
220 $wp_customize,
221 "wpstream_{$button_type}_{$setting_name}_opacity",
222 array(
223 'label' => esc_html__('Opacity', 'hello-wpstream'),
224 'section' => 'wpstream_buttons_colors',
225 'min' => 0,
226 'max' => 100,
227 'step' => 1,
228 'unit' => '%',
229 )
230 )
231 );
232 }