These results are based on our legacy PHP analysis, consider migrating to our new PHP analysis engine instead. Learn more
1 | <?php |
||
2 | /** |
||
3 | * An example file demonstrating how to add all controls. |
||
4 | * |
||
5 | * @package Kirki |
||
6 | * @category Core |
||
7 | * @author Aristeides Stathopoulos |
||
8 | * @copyright Copyright (c) 2017, Aristeides Stathopoulos |
||
9 | * @license http://opensource.org/licenses/https://opensource.org/licenses/MIT |
||
10 | * @since 3.0.12 |
||
11 | */ |
||
12 | |||
13 | // Exit if accessed directly. |
||
14 | if ( ! defined( 'ABSPATH' ) ) { |
||
15 | exit; |
||
16 | } |
||
17 | |||
18 | // Do not proceed if Kirki does not exist. |
||
19 | if ( ! class_exists( 'Kirki' ) ) { |
||
20 | return; |
||
21 | } |
||
22 | |||
23 | /** |
||
24 | * First of all, add the config. |
||
25 | * |
||
26 | * @link https://aristath.github.io/kirki/docs/getting-started/config.html |
||
27 | */ |
||
28 | Kirki::add_config( |
||
29 | 'kirki_demo', array( |
||
30 | 'capability' => 'edit_theme_options', |
||
31 | 'option_type' => 'theme_mod', |
||
32 | ) |
||
33 | ); |
||
34 | |||
35 | /** |
||
36 | * Add a panel. |
||
37 | * |
||
38 | * @link https://aristath.github.io/kirki/docs/getting-started/panels.html |
||
39 | */ |
||
40 | Kirki::add_panel( |
||
41 | 'kirki_demo_panel', array( |
||
42 | 'priority' => 10, |
||
43 | 'title' => esc_attr__( 'Kirki Demo Panel', 'kirki' ), |
||
44 | 'description' => esc_attr__( 'Contains sections for all kirki controls.', 'kirki' ), |
||
45 | ) |
||
46 | ); |
||
47 | |||
48 | /** |
||
49 | * Add Sections. |
||
50 | * |
||
51 | * We'll be doing things a bit differently here, just to demonstrate an example. |
||
52 | * We're going to define 1 section per control-type just to keep things clean and separate. |
||
53 | * |
||
54 | * @link https://aristath.github.io/kirki/docs/getting-started/sections.html |
||
55 | */ |
||
56 | $sections = array( |
||
57 | 'background' => array( esc_attr__( 'Background', 'kirki' ), '' ), |
||
58 | 'code' => array( esc_attr__( 'Code', 'kirki' ), '' ), |
||
59 | 'checkbox' => array( esc_attr__( 'Checkbox', 'kirki' ), '' ), |
||
60 | 'color' => array( esc_attr__( 'Color', 'kirki' ), '' ), |
||
61 | 'color-palette' => array( esc_attr__( 'Color Palette', 'kirki' ), '' ), |
||
62 | 'custom' => array( esc_attr__( 'Custom', 'kirki' ), '' ), |
||
63 | 'dashicons' => array( esc_attr__( 'Dashicons', 'kirki' ), '' ), |
||
64 | 'date' => array( esc_attr__( 'Date', 'kirki' ), '' ), |
||
65 | 'dimension' => array( esc_attr__( 'Dimension', 'kirki' ), '' ), |
||
66 | 'dimensions' => array( esc_attr__( 'Dimensions', 'kirki' ), '' ), |
||
67 | 'editor' => array( esc_attr__( 'Editor', 'kirki' ), '' ), |
||
68 | 'fontawesome' => array( esc_attr__( 'Font-Awesome', 'kirki' ), '' ), |
||
69 | 'generic' => array( esc_attr__( 'Generic', 'kirki' ), '' ), |
||
70 | 'image' => array( esc_attr__( 'Image', 'kirki' ), '' ), |
||
71 | 'multicheck' => array( esc_attr__( 'Multicheck', 'kirki' ), '' ), |
||
72 | 'multicolor' => array( esc_attr__( 'Multicolor', 'kirki' ), '' ), |
||
73 | 'number' => array( esc_attr__( 'Number', 'kirki' ), '' ), |
||
74 | 'palette' => array( esc_attr__( 'Palette', 'kirki' ), '' ), |
||
75 | 'preset' => array( esc_attr__( 'Preset', 'kirki' ), '' ), |
||
76 | 'radio' => array( esc_attr__( 'Radio', 'kirki' ), esc_attr__( 'A plain Radio control.', 'kirki' ) ), |
||
77 | 'radio-buttonset' => array( esc_attr__( 'Radio Buttonset', 'kirki' ), esc_attr__( 'Radio-Buttonset controls are essentially radio controls with some fancy styling to make them look cooler.', 'kirki' ) ), |
||
78 | 'radio-image' => array( esc_attr__( 'Radio Image', 'kirki' ), esc_attr__( 'Radio-Image controls are essentially radio controls with some fancy styles to use images', 'kirki' ) ), |
||
79 | 'repeater' => array( esc_attr__( 'Repeater', 'kirki' ), '' ), |
||
80 | 'select' => array( esc_attr__( 'Select', 'kirki' ), '' ), |
||
81 | 'slider' => array( esc_attr__( 'Slider', 'kirki' ), '' ), |
||
82 | 'sortable' => array( esc_attr__( 'Sortable', 'kirki' ), '' ), |
||
83 | 'switch' => array( esc_attr__( 'Switch', 'kirki' ), '' ), |
||
84 | 'toggle' => array( esc_attr__( 'Toggle', 'kirki' ), '' ), |
||
85 | 'typography' => array( esc_attr__( 'Typography', 'kirki' ), '' ), |
||
86 | ); |
||
87 | foreach ( $sections as $section_id => $section ) { |
||
88 | Kirki::add_section( |
||
89 | str_replace( '-', '_', $section_id ) . '_section', array( |
||
90 | 'title' => $section[0], |
||
91 | 'description' => $section[1], |
||
92 | 'panel' => 'kirki_demo_panel', |
||
93 | ) |
||
94 | ); |
||
95 | } |
||
96 | |||
97 | /** |
||
98 | * A proxy function. Automatically passes-on the config-id. |
||
99 | * |
||
100 | * @param array $args The field arguments. |
||
101 | */ |
||
102 | function my_config_kirki_add_field( $args ) { |
||
103 | Kirki::add_field( 'kirki_demo', $args ); |
||
104 | } |
||
105 | |||
106 | /** |
||
107 | * Background Control. |
||
108 | * |
||
109 | * @todo Triggers change on load. |
||
110 | */ |
||
111 | my_config_kirki_add_field( |
||
112 | array( |
||
113 | 'type' => 'background', |
||
114 | 'settings' => 'background_setting', |
||
115 | 'label' => esc_attr__( 'Background Control', 'kirki' ), |
||
116 | 'description' => esc_attr__( 'Background conrols are pretty complex! (but useful if properly used)', 'kirki' ), |
||
117 | 'section' => 'background_section', |
||
118 | 'default' => array( |
||
119 | 'background-color' => 'rgba(20,20,20,.8)', |
||
120 | 'background-image' => '', |
||
121 | 'background-repeat' => 'repeat-all', |
||
122 | 'background-position' => 'center center', |
||
123 | 'background-size' => 'cover', |
||
124 | 'background-attachment' => 'scroll', |
||
125 | ), |
||
126 | ) |
||
127 | ); |
||
128 | |||
129 | /** |
||
130 | * Code control. |
||
131 | * |
||
132 | * @link https://aristath.github.io/kirki/docs/controls/code.html |
||
133 | */ |
||
134 | my_config_kirki_add_field( |
||
135 | array( |
||
136 | 'type' => 'code', |
||
137 | 'settings' => 'code_setting', |
||
138 | 'label' => esc_attr__( 'Code Control', 'kirki' ), |
||
139 | 'description' => esc_attr__( 'Description', 'kirki' ), |
||
140 | 'section' => 'code_section', |
||
141 | 'default' => '', |
||
142 | 'choices' => array( |
||
143 | 'language' => 'css', |
||
144 | 'theme' => 'monokai', |
||
145 | ), |
||
146 | ) |
||
147 | ); |
||
148 | |||
149 | /** |
||
150 | * Checkbox control. |
||
151 | * |
||
152 | * @link https://aristath.github.io/kirki/docs/controls/checkbox.html |
||
153 | */ |
||
154 | my_config_kirki_add_field( |
||
155 | array( |
||
156 | 'type' => 'checkbox', |
||
157 | 'settings' => 'checkbox_setting', |
||
158 | 'label' => esc_attr__( 'Checkbox Control', 'kirki' ), |
||
159 | 'description' => esc_attr__( 'Description', 'kirki' ), |
||
160 | 'section' => 'checkbox_section', |
||
161 | 'default' => true, |
||
162 | ) |
||
163 | ); |
||
164 | |||
165 | /** |
||
166 | * Color Controls. |
||
167 | * |
||
168 | * @link https://aristath.github.io/kirki/docs/controls/color.html |
||
169 | */ |
||
170 | my_config_kirki_add_field( |
||
171 | array( |
||
172 | 'type' => 'color', |
||
173 | 'settings' => 'color_setting_hex', |
||
174 | 'label' => __( 'Color Control (hex-only)', 'kirki' ), |
||
175 | 'description' => esc_attr__( 'This is a color control - without alpha channel.', 'kirki' ), |
||
176 | 'section' => 'color_section', |
||
177 | 'default' => '#0008DC', |
||
178 | ) |
||
179 | ); |
||
180 | |||
181 | my_config_kirki_add_field( |
||
182 | array( |
||
183 | 'type' => 'color', |
||
184 | 'settings' => 'color_setting_rgba', |
||
185 | 'label' => __( 'Color Control (with alpha channel)', 'kirki' ), |
||
186 | 'description' => esc_attr__( 'This is a color control - with alpha channel.', 'kirki' ), |
||
187 | 'section' => 'color_section', |
||
188 | 'default' => '#0088CC', |
||
189 | 'choices' => array( |
||
190 | 'alpha' => true, |
||
191 | ), |
||
192 | ) |
||
193 | ); |
||
194 | |||
195 | my_config_kirki_add_field( |
||
196 | array( |
||
197 | 'type' => 'color', |
||
198 | 'settings' => 'color_setting_hue', |
||
199 | 'label' => __( 'Color Control - hue only.', 'kirki' ), |
||
200 | 'description' => esc_attr__( 'This is a color control - hue only.', 'kirki' ), |
||
201 | 'section' => 'color_section', |
||
202 | 'default' => 160, |
||
203 | 'mode' => 'hue', |
||
204 | ) |
||
205 | ); |
||
206 | |||
207 | /** |
||
208 | * DateTime Control. |
||
209 | */ |
||
210 | my_config_kirki_add_field( |
||
211 | array( |
||
212 | 'type' => 'date', |
||
213 | 'settings' => 'date_setting', |
||
214 | 'label' => esc_attr__( 'Date Control', 'kirki' ), |
||
215 | 'description' => esc_attr__( 'This is a date control.', 'kirki' ), |
||
216 | 'section' => 'date_section', |
||
217 | 'default' => '', |
||
218 | ) |
||
219 | ); |
||
220 | |||
221 | /** |
||
222 | * Editor Controls |
||
223 | */ |
||
224 | my_config_kirki_add_field( |
||
225 | array( |
||
226 | 'type' => 'editor', |
||
227 | 'settings' => 'editor_1', |
||
228 | 'label' => esc_attr__( 'First Editor Control', 'kirki' ), |
||
229 | 'description' => esc_attr__( 'This is an editor control.', 'kirki' ), |
||
230 | 'section' => 'editor_section', |
||
231 | 'default' => '', |
||
232 | ) |
||
233 | ); |
||
234 | |||
235 | my_config_kirki_add_field( |
||
236 | array( |
||
237 | 'type' => 'editor', |
||
238 | 'settings' => 'editor_2', |
||
239 | 'label' => esc_attr__( 'Second Editor Control', 'kirki' ), |
||
240 | 'description' => esc_attr__( 'This is a 2nd editor control just to check that we do not have issues with multiple instances.', 'kirki' ), |
||
241 | 'section' => 'editor_section', |
||
242 | 'default' => esc_attr__( 'Default Text', 'kirki' ), |
||
243 | ) |
||
244 | ); |
||
245 | |||
246 | /** |
||
247 | * Color-Palette Controls. |
||
248 | * |
||
249 | * @link https://aristath.github.io/kirki/docs/controls/color-palette.html |
||
250 | */ |
||
251 | my_config_kirki_add_field( |
||
252 | array( |
||
253 | 'type' => 'color-palette', |
||
254 | 'settings' => 'color_palette_setting_0', |
||
255 | 'label' => esc_attr__( 'Color-Palette', 'kirki' ), |
||
256 | 'description' => esc_attr__( 'This is a color-palette control', 'kirki' ), |
||
257 | 'section' => 'color_palette_section', |
||
258 | 'default' => '#888888', |
||
259 | 'choices' => array( |
||
260 | 'colors' => array( '#000000', '#222222', '#444444', '#666666', '#888888', '#aaaaaa', '#cccccc', '#eeeeee', '#ffffff' ), |
||
261 | 'style' => 'round', |
||
262 | ), |
||
263 | ) |
||
264 | ); |
||
265 | |||
266 | my_config_kirki_add_field( |
||
267 | array( |
||
268 | 'type' => 'color-palette', |
||
269 | 'settings' => 'color_palette_setting_4', |
||
270 | 'label' => esc_attr__( 'Color-Palette', 'kirki' ), |
||
271 | 'description' => esc_attr__( 'Material Design Colors - all', 'kirki' ), |
||
272 | 'section' => 'color_palette_section', |
||
273 | 'default' => '#F44336', |
||
274 | 'choices' => array( |
||
275 | 'colors' => Kirki_Helper::get_material_design_colors( 'all' ), |
||
276 | 'size' => 17, |
||
277 | ), |
||
278 | ) |
||
279 | ); |
||
280 | |||
281 | my_config_kirki_add_field( |
||
282 | array( |
||
283 | 'type' => 'color-palette', |
||
284 | 'settings' => 'color_palette_setting_1', |
||
285 | 'label' => esc_attr__( 'Color-Palette', 'kirki' ), |
||
286 | 'description' => esc_attr__( 'Material Design Colors - primary', 'kirki' ), |
||
287 | 'section' => 'color_palette_section', |
||
288 | 'default' => '#000000', |
||
289 | 'choices' => array( |
||
290 | 'colors' => Kirki_Helper::get_material_design_colors( 'primary' ), |
||
291 | 'size' => 25, |
||
292 | ), |
||
293 | ) |
||
294 | ); |
||
295 | |||
296 | my_config_kirki_add_field( |
||
297 | array( |
||
298 | 'type' => 'color-palette', |
||
299 | 'settings' => 'color_palette_setting_2', |
||
300 | 'label' => esc_attr__( 'Color-Palette', 'kirki' ), |
||
301 | 'description' => esc_attr__( 'Material Design Colors - red', 'kirki' ), |
||
302 | 'section' => 'color_palette_section', |
||
303 | 'default' => '#FF1744', |
||
304 | 'choices' => array( |
||
305 | 'colors' => Kirki_Helper::get_material_design_colors( 'red' ), |
||
306 | 'size' => 16, |
||
307 | ), |
||
308 | ) |
||
309 | ); |
||
310 | |||
311 | my_config_kirki_add_field( |
||
312 | array( |
||
313 | 'type' => 'color-palette', |
||
314 | 'settings' => 'color_palette_setting_3', |
||
315 | 'label' => esc_attr__( 'Color-Palette', 'kirki' ), |
||
316 | 'description' => esc_attr__( 'Material Design Colors - A100', 'kirki' ), |
||
317 | 'section' => 'color_palette_section', |
||
318 | 'default' => '#FF80AB', |
||
319 | 'choices' => array( |
||
320 | 'colors' => Kirki_Helper::get_material_design_colors( 'A100' ), |
||
321 | 'size' => 60, |
||
322 | 'style' => 'round', |
||
323 | ), |
||
324 | ) |
||
325 | ); |
||
326 | |||
327 | /** |
||
328 | * Dashicons control. |
||
329 | * |
||
330 | * @link https://aristath.github.io/kirki/docs/controls/dashicons.html |
||
331 | */ |
||
332 | my_config_kirki_add_field( |
||
333 | array( |
||
334 | 'type' => 'dashicons', |
||
335 | 'settings' => 'dashicons_setting_0', |
||
336 | 'label' => esc_attr__( 'Dashicons Control', 'kirki' ), |
||
337 | 'description' => esc_attr__( 'Using a custom array of dashicons', 'kirki' ), |
||
338 | 'section' => 'dashicons_section', |
||
339 | 'default' => 'menu', |
||
340 | 'choices' => array( |
||
341 | 'menu', |
||
342 | 'admin-site', |
||
343 | 'dashboard', |
||
344 | 'admin-post', |
||
345 | 'admin-media', |
||
346 | 'admin-links', |
||
347 | 'admin-page', |
||
348 | ), |
||
349 | ) |
||
350 | ); |
||
351 | |||
352 | my_config_kirki_add_field( |
||
353 | array( |
||
354 | 'type' => 'dashicons', |
||
355 | 'settings' => 'dashicons_setting_1', |
||
356 | 'label' => esc_attr__( 'All Dashicons', 'kirki' ), |
||
357 | 'description' => esc_attr__( 'Showing all dashicons', 'kirki' ), |
||
358 | 'section' => 'dashicons_section', |
||
359 | 'default' => 'menu', |
||
360 | ) |
||
361 | ); |
||
362 | |||
363 | /** |
||
364 | * Dimension Control. |
||
365 | */ |
||
366 | my_config_kirki_add_field( |
||
367 | array( |
||
368 | 'type' => 'dimension', |
||
369 | 'settings' => 'dimension_0', |
||
370 | 'label' => esc_attr__( 'Dimension Control', 'kirki' ), |
||
371 | 'description' => esc_attr__( 'Description Here.', 'kirki' ), |
||
372 | 'section' => 'dimension_section', |
||
373 | 'default' => '10px', |
||
374 | ) |
||
375 | ); |
||
376 | |||
377 | /** |
||
378 | * Dimensions Control. |
||
379 | */ |
||
380 | my_config_kirki_add_field( |
||
381 | array( |
||
382 | 'type' => 'dimensions', |
||
383 | 'settings' => 'dimensions_0', |
||
384 | 'label' => esc_attr__( 'Dimension Control', 'kirki' ), |
||
385 | 'description' => esc_attr__( 'Description Here.', 'kirki' ), |
||
386 | 'section' => 'dimensions_section', |
||
387 | 'default' => array( |
||
388 | 'width' => '100px', |
||
389 | 'height' => '100px', |
||
390 | ), |
||
391 | ) |
||
392 | ); |
||
393 | |||
394 | my_config_kirki_add_field( |
||
395 | array( |
||
396 | 'type' => 'dimensions', |
||
397 | 'settings' => 'dimensions_1', |
||
398 | 'label' => esc_attr__( 'Dimension Control', 'kirki' ), |
||
399 | 'description' => esc_attr__( 'Description Here.', 'kirki' ), |
||
400 | 'section' => 'dimensions_section', |
||
401 | 'default' => array( |
||
402 | 'padding-top' => '1em', |
||
403 | 'padding-bottom' => '10rem', |
||
404 | 'padding-left' => '1vh', |
||
405 | 'padding-right' => '10px', |
||
406 | ), |
||
407 | ) |
||
408 | ); |
||
409 | |||
410 | /** |
||
411 | * Font-Awesome Control. |
||
412 | */ |
||
413 | my_config_kirki_add_field( |
||
414 | array( |
||
415 | 'type' => 'fontawesome', |
||
416 | 'settings' => 'fontawesome_setting', |
||
417 | 'label' => esc_attr__( 'Font Awesome Control', 'kirki' ), |
||
418 | 'description' => esc_attr__( 'Description Here.', 'kirki' ), |
||
419 | 'section' => 'fontawesome_section', |
||
420 | 'default' => 'bath', |
||
421 | ) |
||
422 | ); |
||
423 | |||
424 | /** |
||
425 | * Generic Controls. |
||
426 | */ |
||
427 | my_config_kirki_add_field( |
||
428 | array( |
||
429 | 'type' => 'text', |
||
430 | 'settings' => 'generic_text_setting', |
||
431 | 'label' => esc_attr__( 'Text Control', 'kirki' ), |
||
432 | 'description' => esc_attr__( 'Description', 'kirki' ), |
||
433 | 'section' => 'generic_section', |
||
434 | 'default' => '', |
||
435 | ) |
||
436 | ); |
||
437 | |||
438 | my_config_kirki_add_field( |
||
439 | array( |
||
440 | 'type' => 'textarea', |
||
441 | 'settings' => 'generic_textarea_setting', |
||
442 | 'label' => esc_attr__( 'Textarea Control', 'kirki' ), |
||
443 | 'description' => esc_attr__( 'Description', 'kirki' ), |
||
444 | 'section' => 'generic_section', |
||
445 | 'default' => '', |
||
446 | ) |
||
447 | ); |
||
448 | |||
449 | my_config_kirki_add_field( |
||
450 | array( |
||
451 | 'type' => 'generic', |
||
452 | 'settings' => 'generic_custom_setting', |
||
453 | 'label' => esc_attr__( 'Custom input Control.', 'kirki' ), |
||
454 | 'description' => esc_attr__( 'The "generic" control allows you to add any input type you want. In this case we use type="password" and define custom styles.', 'kirki' ), |
||
455 | 'section' => 'generic_section', |
||
456 | 'default' => '', |
||
457 | 'choices' => array( |
||
458 | 'element' => 'input', |
||
459 | 'type' => 'password', |
||
460 | 'style' => 'background-color:black;color:red;', |
||
461 | 'data-foo' => 'bar', |
||
462 | ), |
||
463 | ) |
||
464 | ); |
||
465 | |||
466 | /** |
||
467 | * Image Control. |
||
468 | */ |
||
469 | my_config_kirki_add_field( |
||
470 | array( |
||
471 | 'type' => 'image', |
||
472 | 'settings' => 'image_setting_url', |
||
473 | 'label' => esc_attr__( 'Image Control (URL)', 'kirki' ), |
||
474 | 'description' => esc_attr__( 'Description Here.', 'kirki' ), |
||
475 | 'section' => 'image_section', |
||
476 | 'default' => '', |
||
477 | ) |
||
478 | ); |
||
479 | |||
480 | my_config_kirki_add_field( |
||
481 | array( |
||
482 | 'type' => 'image', |
||
483 | 'settings' => 'image_setting_id', |
||
484 | 'label' => esc_attr__( 'Image Control (ID)', 'kirki' ), |
||
485 | 'description' => esc_attr__( 'Description Here.', 'kirki' ), |
||
486 | 'section' => 'image_section', |
||
487 | 'default' => '', |
||
488 | 'choices' => array( |
||
489 | 'save_as' => 'id', |
||
490 | ), |
||
491 | ) |
||
492 | ); |
||
493 | |||
494 | my_config_kirki_add_field( |
||
495 | array( |
||
496 | 'type' => 'image', |
||
497 | 'settings' => 'image_setting_array', |
||
498 | 'label' => esc_attr__( 'Image Control (array)', 'kirki' ), |
||
499 | 'description' => esc_attr__( 'Description Here.', 'kirki' ), |
||
500 | 'section' => 'image_section', |
||
501 | 'default' => '', |
||
502 | 'choices' => array( |
||
503 | 'save_as' => 'array', |
||
504 | ), |
||
505 | ) |
||
506 | ); |
||
507 | |||
508 | /** |
||
509 | * Multicheck Control. |
||
510 | */ |
||
511 | my_config_kirki_add_field( |
||
512 | array( |
||
513 | 'type' => 'multicheck', |
||
514 | 'settings' => 'multicheck_setting', |
||
515 | 'label' => esc_attr__( 'Multickeck Control', 'kirki' ), |
||
516 | 'section' => 'multicheck_section', |
||
517 | 'default' => array( 'option-1', 'option-3', 'option-4' ), |
||
518 | 'priority' => 10, |
||
519 | 'choices' => array( |
||
520 | 'option-1' => esc_attr__( 'Option 1', 'kirki' ), |
||
521 | 'option-2' => esc_attr__( 'Option 2', 'kirki' ), |
||
522 | 'option-3' => esc_attr__( 'Option 3', 'kirki' ), |
||
523 | 'option-4' => esc_attr__( 'Option 4', 'kirki' ), |
||
524 | 'option-5' => esc_attr__( 'Option 5', 'kirki' ), |
||
525 | ), |
||
526 | ) |
||
527 | ); |
||
528 | |||
529 | /** |
||
530 | * Multicolor Control. |
||
531 | */ |
||
532 | my_config_kirki_add_field( |
||
533 | array( |
||
534 | 'type' => 'multicolor', |
||
535 | 'settings' => 'multicolor_setting', |
||
536 | 'label' => esc_attr__( 'Label', 'kirki' ), |
||
537 | 'section' => 'multicolor_section', |
||
538 | 'priority' => 10, |
||
539 | 'choices' => array( |
||
540 | 'link' => esc_attr__( 'Color', 'kirki' ), |
||
541 | 'hover' => esc_attr__( 'Hover', 'kirki' ), |
||
542 | 'active' => esc_attr__( 'Active', 'kirki' ), |
||
543 | ), |
||
544 | 'alpha' =>true, |
||
0 ignored issues
–
show
introduced
by
![]() |
|||
545 | 'default' => array( |
||
546 | 'link' => '#0088cc', |
||
547 | 'hover' => '#00aaff', |
||
548 | 'active' => '#00ffff', |
||
549 | ), |
||
550 | ) |
||
551 | ); |
||
552 | |||
553 | /** |
||
554 | * Number Control. |
||
555 | */ |
||
556 | my_config_kirki_add_field( |
||
557 | array( |
||
558 | 'type' => 'number', |
||
559 | 'settings' => 'number_setting', |
||
560 | 'label' => esc_attr__( 'Label', 'kirki' ), |
||
561 | 'section' => 'number_section', |
||
562 | 'priority' => 10, |
||
563 | 'choices' => array( |
||
564 | 'min' => -5, |
||
565 | 'max' => 5, |
||
566 | 'step' => 1, |
||
567 | ), |
||
568 | ) |
||
569 | ); |
||
570 | |||
571 | /** |
||
572 | * Palette Control. |
||
573 | */ |
||
574 | my_config_kirki_add_field( |
||
575 | array( |
||
576 | 'type' => 'palette', |
||
577 | 'settings' => 'palette_setting', |
||
578 | 'label' => esc_attr__( 'Label', 'kirki' ), |
||
579 | 'section' => 'palette_section', |
||
580 | 'default' => 'blue', |
||
581 | 'choices' => array( |
||
582 | 'a200' => Kirki_Helper::get_material_design_colors( 'A200' ), |
||
583 | 'blue' => Kirki_Helper::get_material_design_colors( 'blue' ), |
||
584 | 'green' => array( '#E8F5E9', '#C8E6C9', '#A5D6A7', '#81C784', '#66BB6A', '#4CAF50', '#43A047', '#388E3C', '#2E7D32', '#1B5E20', '#B9F6CA', '#69F0AE', '#00E676', '#00C853' ), |
||
585 | 'bnw' => array( '#000000', '#ffffff' ), |
||
586 | ), |
||
587 | ) |
||
588 | ); |
||
589 | |||
590 | /** |
||
591 | * Radio Control. |
||
592 | */ |
||
593 | my_config_kirki_add_field( |
||
594 | array( |
||
595 | 'type' => 'radio', |
||
596 | 'settings' => 'radio_setting', |
||
597 | 'label' => esc_attr__( 'Radio Control', 'kirki' ), |
||
598 | 'description' => esc_attr__( 'The description here.', 'kirki' ), |
||
599 | 'section' => 'radio_section', |
||
600 | 'default' => 'option-3', |
||
601 | 'choices' => array( |
||
602 | 'option-1' => esc_attr__( 'Option 1', 'kirki' ), |
||
603 | 'option-2' => esc_attr__( 'Option 2', 'kirki' ), |
||
604 | 'option-3' => esc_attr__( 'Option 3', 'kirki' ), |
||
605 | 'option-4' => esc_attr__( 'Option 4', 'kirki' ), |
||
606 | 'option-5' => esc_attr__( 'Option 5', 'kirki' ), |
||
607 | ), |
||
608 | ) |
||
609 | ); |
||
610 | |||
611 | /** |
||
612 | * Radio-Buttonset Control. |
||
613 | */ |
||
614 | my_config_kirki_add_field( |
||
615 | array( |
||
616 | 'type' => 'radio-buttonset', |
||
617 | 'settings' => 'radio_buttonset_setting', |
||
618 | 'label' => esc_attr__( 'Radio-Buttonset Control', 'kirki' ), |
||
619 | 'description' => esc_attr__( 'The description here.', 'kirki' ), |
||
620 | 'section' => 'radio_buttonset_section', |
||
621 | 'default' => 'option-2', |
||
622 | 'choices' => array( |
||
623 | 'option-1' => esc_attr__( 'Option 1', 'kirki' ), |
||
624 | 'option-2' => esc_attr__( 'Option 2', 'kirki' ), |
||
625 | 'option-3' => esc_attr__( 'Option 3', 'kirki' ), |
||
626 | ), |
||
627 | ) |
||
628 | ); |
||
629 | |||
630 | /** |
||
631 | * Radio-Image Control. |
||
632 | */ |
||
633 | my_config_kirki_add_field( |
||
634 | array( |
||
635 | 'type' => 'radio-image', |
||
636 | 'settings' => 'radio_image_setting', |
||
637 | 'label' => esc_attr__( 'Radio-Image Control', 'kirki' ), |
||
638 | 'description' => esc_attr__( 'The description here.', 'kirki' ), |
||
639 | 'section' => 'radio_image_section', |
||
640 | 'default' => 'travel', |
||
641 | 'choices' => array( |
||
642 | 'moto' => 'https://jawordpressorg.github.io/wapuu/wapuu-archive/wapuu-moto.png', |
||
643 | 'cossack' => 'https://raw.githubusercontent.com/templatemonster/cossack-wapuula/master/cossack-wapuula.png', |
||
644 | 'travel' => 'https://jawordpressorg.github.io/wapuu/wapuu-archive/wapuu-travel.png', |
||
645 | ), |
||
646 | ) |
||
647 | ); |
||
648 | |||
649 | /** |
||
650 | * Select Control. |
||
651 | */ |
||
652 | my_config_kirki_add_field( |
||
653 | array( |
||
0 ignored issues
–
show
|
|||
654 | 'type' => 'select', |
||
655 | 'settings' => 'select_setting', |
||
656 | 'label' => esc_attr__( 'Select Control', 'kirki' ), |
||
657 | 'description' => esc_attr__( 'The description here.', 'kirki' ), |
||
658 | 'section' => 'select_section', |
||
659 | 'default' => 'option-3', |
||
660 | 'choices' => array( |
||
661 | 'option-1' => esc_attr__( 'Option 1', 'kirki' ), |
||
662 | 'option-2' => esc_attr__( 'Option 2', 'kirki' ), |
||
663 | 'option-3' => esc_attr__( 'Option 3', 'kirki' ), |
||
664 | 'option-4' => esc_attr__( 'Option 4', 'kirki' ), |
||
665 | 'option-5' => esc_attr__( 'Option 5', 'kirki' ), |
||
666 | ), |
||
667 | ) |
||
0 ignored issues
–
show
|
|||
668 | ); |
||
669 | |||
670 | my_config_kirki_add_field( |
||
671 | array( |
||
0 ignored issues
–
show
|
|||
672 | 'type' => 'select', |
||
673 | 'settings' => 'select_setting_multiple', |
||
674 | 'label' => esc_attr__( 'Select Control', 'kirki' ), |
||
675 | 'description' => esc_attr__( 'The description here.', 'kirki' ), |
||
676 | 'section' => 'select_section', |
||
677 | 'default' => 'option-3', |
||
678 | 'multiple' => 3, |
||
679 | 'choices' => array( |
||
680 | 'option-1' => esc_attr__( 'Option 1', 'kirki' ), |
||
681 | 'option-2' => esc_attr__( 'Option 2', 'kirki' ), |
||
682 | 'option-3' => esc_attr__( 'Option 3', 'kirki' ), |
||
683 | 'option-4' => esc_attr__( 'Option 4', 'kirki' ), |
||
684 | 'option-5' => esc_attr__( 'Option 5', 'kirki' ), |
||
685 | ), |
||
686 | ) |
||
0 ignored issues
–
show
|
|||
687 | ); |
||
688 | |||
689 | /** |
||
690 | * Slider Control. |
||
691 | */ |
||
692 | my_config_kirki_add_field( |
||
693 | array( |
||
694 | 'type' => 'slider', |
||
695 | 'settings' => 'slider_setting', |
||
696 | 'label' => esc_attr__( 'Slider Control', 'kirki' ), |
||
697 | 'description' => esc_attr__( 'The description here.', 'kirki' ), |
||
698 | 'section' => 'slider_section', |
||
699 | 'default' => '10', |
||
700 | 'choices' => array( |
||
701 | 'min' => 0, |
||
702 | 'max' => 20, |
||
703 | 'step' => 1, |
||
704 | 'suffix' => 'px', |
||
705 | ), |
||
706 | ) |
||
707 | ); |
||
708 | |||
709 | /** |
||
710 | * Sortable control. |
||
711 | */ |
||
712 | my_config_kirki_add_field( |
||
713 | array( |
||
714 | 'type' => 'sortable', |
||
715 | 'settings' => 'sortable_setting', |
||
716 | 'label' => __( 'This is a sortable control.', 'kirki' ), |
||
717 | 'section' => 'sortable_section', |
||
718 | 'default' => array( 'option3', 'option1', 'option4' ), |
||
719 | 'choices' => array( |
||
720 | 'option1' => esc_attr__( 'Option 1', 'kirki' ), |
||
721 | 'option2' => esc_attr__( 'Option 2', 'kirki' ), |
||
722 | 'option3' => esc_attr__( 'Option 3', 'kirki' ), |
||
723 | 'option4' => esc_attr__( 'Option 4', 'kirki' ), |
||
724 | 'option5' => esc_attr__( 'Option 5', 'kirki' ), |
||
725 | 'option6' => esc_attr__( 'Option 6', 'kirki' ), |
||
726 | ), |
||
727 | ) |
||
728 | ); |
||
729 | |||
730 | /** |
||
731 | * Switch control. |
||
732 | */ |
||
733 | my_config_kirki_add_field( |
||
734 | array( |
||
0 ignored issues
–
show
|
|||
735 | 'type' => 'switch', |
||
736 | 'settings' => 'switch_setting', |
||
737 | 'label' => esc_attr__( 'Switch Control', 'kirki' ), |
||
738 | 'description' => esc_attr__( 'Description', 'kirki' ), |
||
739 | 'section' => 'switch_section', |
||
740 | 'default' => true, |
||
741 | ) |
||
0 ignored issues
–
show
|
|||
742 | ); |
||
743 | |||
744 | my_config_kirki_add_field( |
||
745 | array( |
||
0 ignored issues
–
show
|
|||
746 | 'type' => 'switch', |
||
747 | 'settings' => 'switch_setting_custom_label', |
||
748 | 'label' => esc_attr__( 'Switch Control with custom labels', 'kirki' ), |
||
749 | 'description' => esc_attr__( 'Description', 'kirki' ), |
||
750 | 'section' => 'switch_section', |
||
751 | 'default' => true, |
||
752 | 'choices' => array( |
||
753 | 'on' => esc_attr__( 'Enabled', 'kirki' ), |
||
754 | 'off' => esc_attr__( 'Disabled', 'kirki' ), |
||
755 | ), |
||
756 | ) |
||
0 ignored issues
–
show
|
|||
757 | ); |
||
758 | |||
759 | /** |
||
760 | * Toggle control. |
||
761 | */ |
||
762 | my_config_kirki_add_field( |
||
763 | array( |
||
764 | 'type' => 'toggle', |
||
765 | 'settings' => 'toggle_setting', |
||
766 | 'label' => esc_attr__( 'Toggle Control', 'kirki' ), |
||
767 | 'description' => esc_attr__( 'Description', 'kirki' ), |
||
768 | 'section' => 'toggle_section', |
||
769 | 'default' => true, |
||
770 | ) |
||
771 | ); |
||
772 | |||
773 | /** |
||
774 | * Typography Control. |
||
775 | */ |
||
776 | my_config_kirki_add_field( |
||
777 | array( |
||
778 | 'type' => 'typography', |
||
779 | 'settings' => 'typography_setting_0', |
||
780 | 'label' => esc_attr__( 'Typography Control Label', 'kirki' ), |
||
781 | 'description' => esc_attr__( 'The full set of options.', 'kirki' ), |
||
782 | 'section' => 'typography_section', |
||
783 | 'default' => array( |
||
784 | 'font-family' => 'Roboto', |
||
785 | 'variant' => 'regular', |
||
786 | 'font-size' => '14px', |
||
787 | 'line-height' => '1.5', |
||
788 | 'letter-spacing' => '0', |
||
789 | 'subsets' => array( 'latin-ext' ), |
||
790 | 'color' => '#333333', |
||
791 | 'text-transform' => 'none', |
||
792 | 'text-align' => 'left', |
||
793 | ), |
||
794 | 'priority' => 10, |
||
795 | ) |
||
796 | ); |
||
797 |