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
|
|
|
'default' => array( |
545
|
|
|
'link' => '#0088cc', |
546
|
|
|
'hover' => '#00aaff', |
547
|
|
|
'active' => '#00ffff', |
548
|
|
|
), |
549
|
|
|
) |
550
|
|
|
); |
551
|
|
|
|
552
|
|
|
/** |
553
|
|
|
* Number Control. |
554
|
|
|
*/ |
555
|
|
|
my_config_kirki_add_field( |
556
|
|
|
array( |
557
|
|
|
'type' => 'number', |
558
|
|
|
'settings' => 'number_setting', |
559
|
|
|
'label' => esc_attr__( 'Label', 'kirki' ), |
560
|
|
|
'section' => 'number_section', |
561
|
|
|
'priority' => 10, |
562
|
|
|
'choices' => array( |
563
|
|
|
'min' => -5, |
564
|
|
|
'max' => 5, |
565
|
|
|
'step' => 1, |
566
|
|
|
), |
567
|
|
|
) |
568
|
|
|
); |
569
|
|
|
|
570
|
|
|
/** |
571
|
|
|
* Palette Control. |
572
|
|
|
*/ |
573
|
|
|
my_config_kirki_add_field( |
574
|
|
|
array( |
575
|
|
|
'type' => 'palette', |
576
|
|
|
'settings' => 'palette_setting', |
577
|
|
|
'label' => esc_attr__( 'Label', 'kirki' ), |
578
|
|
|
'section' => 'palette_section', |
579
|
|
|
'default' => 'blue', |
580
|
|
|
'choices' => array( |
581
|
|
|
'a200' => Kirki_Helper::get_material_design_colors( 'A200' ), |
582
|
|
|
'blue' => Kirki_Helper::get_material_design_colors( 'blue' ), |
583
|
|
|
'green' => array( '#E8F5E9', '#C8E6C9', '#A5D6A7', '#81C784', '#66BB6A', '#4CAF50', '#43A047', '#388E3C', '#2E7D32', '#1B5E20', '#B9F6CA', '#69F0AE', '#00E676', '#00C853' ), |
584
|
|
|
'bnw' => array( '#000000', '#ffffff' ), |
585
|
|
|
), |
586
|
|
|
) |
587
|
|
|
); |
588
|
|
|
|
589
|
|
|
/** |
590
|
|
|
* Radio Control. |
591
|
|
|
*/ |
592
|
|
|
my_config_kirki_add_field( |
593
|
|
|
array( |
594
|
|
|
'type' => 'radio', |
595
|
|
|
'settings' => 'radio_setting', |
596
|
|
|
'label' => esc_attr__( 'Radio Control', 'kirki' ), |
597
|
|
|
'description' => esc_attr__( 'The description here.', 'kirki' ), |
598
|
|
|
'section' => 'radio_section', |
599
|
|
|
'default' => 'option-3', |
600
|
|
|
'choices' => array( |
601
|
|
|
'option-1' => esc_attr__( 'Option 1', 'kirki' ), |
602
|
|
|
'option-2' => esc_attr__( 'Option 2', 'kirki' ), |
603
|
|
|
'option-3' => esc_attr__( 'Option 3', 'kirki' ), |
604
|
|
|
'option-4' => esc_attr__( 'Option 4', 'kirki' ), |
605
|
|
|
'option-5' => esc_attr__( 'Option 5', 'kirki' ), |
606
|
|
|
), |
607
|
|
|
) |
608
|
|
|
); |
609
|
|
|
|
610
|
|
|
/** |
611
|
|
|
* Radio-Buttonset Control. |
612
|
|
|
*/ |
613
|
|
|
my_config_kirki_add_field( |
614
|
|
|
array( |
615
|
|
|
'type' => 'radio-buttonset', |
616
|
|
|
'settings' => 'radio_buttonset_setting', |
617
|
|
|
'label' => esc_attr__( 'Radio-Buttonset Control', 'kirki' ), |
618
|
|
|
'description' => esc_attr__( 'The description here.', 'kirki' ), |
619
|
|
|
'section' => 'radio_buttonset_section', |
620
|
|
|
'default' => 'option-2', |
621
|
|
|
'choices' => array( |
622
|
|
|
'option-1' => esc_attr__( 'Option 1', 'kirki' ), |
623
|
|
|
'option-2' => esc_attr__( 'Option 2', 'kirki' ), |
624
|
|
|
'option-3' => esc_attr__( 'Option 3', 'kirki' ), |
625
|
|
|
), |
626
|
|
|
) |
627
|
|
|
); |
628
|
|
|
|
629
|
|
|
/** |
630
|
|
|
* Radio-Image Control. |
631
|
|
|
*/ |
632
|
|
|
my_config_kirki_add_field( |
633
|
|
|
array( |
634
|
|
|
'type' => 'radio-image', |
635
|
|
|
'settings' => 'radio_image_setting', |
636
|
|
|
'label' => esc_attr__( 'Radio-Image Control', 'kirki' ), |
637
|
|
|
'description' => esc_attr__( 'The description here.', 'kirki' ), |
638
|
|
|
'section' => 'radio_image_section', |
639
|
|
|
'default' => 'travel', |
640
|
|
|
'choices' => array( |
641
|
|
|
'moto' => 'https://jawordpressorg.github.io/wapuu/wapuu-archive/wapuu-moto.png', |
642
|
|
|
'cossack' => 'https://raw.githubusercontent.com/templatemonster/cossack-wapuula/master/cossack-wapuula.png', |
643
|
|
|
'travel' => 'https://jawordpressorg.github.io/wapuu/wapuu-archive/wapuu-travel.png', |
644
|
|
|
), |
645
|
|
|
) |
646
|
|
|
); |
647
|
|
|
|
648
|
|
|
/** |
649
|
|
|
* Select Control. |
650
|
|
|
*/ |
651
|
|
|
my_config_kirki_add_field( |
652
|
|
|
array( |
653
|
|
|
'type' => 'select', |
654
|
|
|
'settings' => 'select_setting', |
655
|
|
|
'label' => esc_attr__( 'Select Control', 'kirki' ), |
656
|
|
|
'description' => esc_attr__( 'The description here.', 'kirki' ), |
657
|
|
|
'section' => 'select_section', |
658
|
|
|
'default' => 'option-3', |
659
|
|
|
'choices' => array( |
660
|
|
|
'option-1' => esc_attr__( 'Option 1', 'kirki' ), |
661
|
|
|
'option-2' => esc_attr__( 'Option 2', 'kirki' ), |
662
|
|
|
'option-3' => esc_attr__( 'Option 3', 'kirki' ), |
663
|
|
|
'option-4' => esc_attr__( 'Option 4', 'kirki' ), |
664
|
|
|
'option-5' => esc_attr__( 'Option 5', 'kirki' ), |
665
|
|
|
), |
666
|
|
|
) |
667
|
|
|
); |
668
|
|
|
|
669
|
|
|
/** |
670
|
|
|
* Slider Control. |
671
|
|
|
*/ |
672
|
|
|
my_config_kirki_add_field( |
673
|
|
|
array( |
674
|
|
|
'type' => 'slider', |
675
|
|
|
'settings' => 'slider_setting', |
676
|
|
|
'label' => esc_attr__( 'Slider Control', 'kirki' ), |
677
|
|
|
'description' => esc_attr__( 'The description here.', 'kirki' ), |
678
|
|
|
'section' => 'slider_section', |
679
|
|
|
'default' => '10', |
680
|
|
|
'choices' => array( |
681
|
|
|
'min' => 0, |
682
|
|
|
'max' => 20, |
683
|
|
|
'step' => 1, |
684
|
|
|
'suffix' => 'px', |
685
|
|
|
), |
686
|
|
|
) |
687
|
|
|
); |
688
|
|
|
|
689
|
|
|
/** |
690
|
|
|
* Sortable control. |
691
|
|
|
*/ |
692
|
|
|
my_config_kirki_add_field( |
693
|
|
|
array( |
694
|
|
|
'type' => 'sortable', |
695
|
|
|
'settings' => 'sortable_setting', |
696
|
|
|
'label' => __( 'This is a sortable control.', 'kirki' ), |
697
|
|
|
'section' => 'sortable_section', |
698
|
|
|
'default' => array( 'option3', 'option1', 'option4' ), |
699
|
|
|
'choices' => array( |
700
|
|
|
'option1' => esc_attr__( 'Option 1', 'kirki' ), |
701
|
|
|
'option2' => esc_attr__( 'Option 2', 'kirki' ), |
702
|
|
|
'option3' => esc_attr__( 'Option 3', 'kirki' ), |
703
|
|
|
'option4' => esc_attr__( 'Option 4', 'kirki' ), |
704
|
|
|
'option5' => esc_attr__( 'Option 5', 'kirki' ), |
705
|
|
|
'option6' => esc_attr__( 'Option 6', 'kirki' ), |
706
|
|
|
), |
707
|
|
|
) |
708
|
|
|
); |
709
|
|
|
|
710
|
|
|
/** |
711
|
|
|
* Switch control. |
712
|
|
|
*/ |
713
|
|
|
my_config_kirki_add_field( |
714
|
|
|
array( |
715
|
|
|
'type' => 'switch', |
716
|
|
|
'settings' => 'switch_setting', |
717
|
|
|
'label' => esc_attr__( 'Switch Control', 'kirki' ), |
718
|
|
|
'description' => esc_attr__( 'Description', 'kirki' ), |
719
|
|
|
'section' => 'switch_section', |
720
|
|
|
'default' => true, |
721
|
|
|
) |
722
|
|
|
); |
723
|
|
|
|
724
|
|
|
/** |
725
|
|
|
* Toggle control. |
726
|
|
|
*/ |
727
|
|
|
my_config_kirki_add_field( |
728
|
|
|
array( |
729
|
|
|
'type' => 'toggle', |
730
|
|
|
'settings' => 'toggle_setting', |
731
|
|
|
'label' => esc_attr__( 'Toggle Control', 'kirki' ), |
732
|
|
|
'description' => esc_attr__( 'Description', 'kirki' ), |
733
|
|
|
'section' => 'toggle_section', |
734
|
|
|
'default' => true, |
735
|
|
|
) |
736
|
|
|
); |
737
|
|
|
|
738
|
|
|
/** |
739
|
|
|
* Typography Control. |
740
|
|
|
*/ |
741
|
|
|
my_config_kirki_add_field( |
742
|
|
|
array( |
743
|
|
|
'type' => 'typography', |
744
|
|
|
'settings' => 'typography_setting_0', |
745
|
|
|
'label' => esc_attr__( 'Typography Control Label', 'kirki' ), |
746
|
|
|
'description' => esc_attr__( 'The full set of options.', 'kirki' ), |
747
|
|
|
'section' => 'typography_section', |
748
|
|
|
'default' => array( |
749
|
|
|
'font-family' => 'Roboto', |
750
|
|
|
'variant' => 'regular', |
751
|
|
|
'font-size' => '14px', |
752
|
|
|
'line-height' => '1.5', |
753
|
|
|
'letter-spacing' => '0', |
754
|
|
|
'subsets' => array( 'latin-ext' ), |
755
|
|
|
'color' => '#333333', |
756
|
|
|
'text-transform' => 'none', |
757
|
|
|
'text-align' => 'left', |
758
|
|
|
), |
759
|
|
|
'priority' => 10, |
760
|
|
|
) |
761
|
|
|
); |
762
|
|
|
|
763
|
|
|
my_config_kirki_add_field( |
764
|
|
|
array( |
765
|
|
|
'type' => 'typography', |
766
|
|
|
'settings' => 'typography_setting_1', |
767
|
|
|
'label' => esc_attr__( 'Typography Control Label', 'kirki' ), |
768
|
|
|
'description' => esc_attr__( 'Just the font-family.', 'kirki' ), |
769
|
|
|
'section' => 'typography_section', |
770
|
|
|
'default' => array( |
771
|
|
|
'font-family' => 'Roboto', |
772
|
|
|
), |
773
|
|
|
) |
774
|
|
|
); |
775
|
|
|
|
776
|
|
|
my_config_kirki_add_field( |
777
|
|
|
array( |
778
|
|
|
'type' => 'typography', |
779
|
|
|
'settings' => 'typography_setting_2', |
780
|
|
|
'label' => esc_attr__( 'Typography Control Label', 'kirki' ), |
781
|
|
|
'description' => esc_attr__( 'Only font-size, line-height, letter-spacing and color.', 'kirki' ), |
782
|
|
|
'section' => 'typography_section', |
783
|
|
|
'default' => array( |
784
|
|
|
'font-size' => '14px', |
785
|
|
|
'line-height' => '1.5', |
786
|
|
|
'letter-spacing' => '0', |
787
|
|
|
'color' => '#333333', |
788
|
|
|
), |
789
|
|
|
) |
790
|
|
|
); |
791
|
|
|
|