Version Description
- 2014-03-14, dev time: 10 hours ==
- Fix: Array to string conversion that happened conditionally when used with googlefonts. (props @groucho75)
- Fix: Background opacity affects background-position of bg image
- Fix: font-weight not being applied on google fonts
- New: Added
kirki_get_option( $setting );
function that also gets default values - Tweak: Singleton for main plugin class
- Fix: Prevent empty help tooltips
- New: Added
toggle
control - New: Added
switch
control - Fix: Color controls were not being reset to default:
- Tweak: Tooltips now loaded via jQuery
- Tweak: Renamed
setting
to settings for consistency with WordPress core - Tweak: Renamed
description
tohelp
andsubtitle
to `description for consistency with WordPress core - Tweak: Backwards-compatibility improvements
- New: Allow hiding background control elements by not including default values for them
- Tweak: Performance improvements
- Tweak: Using WordPress core controls instead of custom ones when those are available
- Tweak: Separate logic for multiple-type controls that were using the "mode" argument. This has been deprecated in favor of completely separate control types.
=
Download this release
Release Info
Developer | aristath |
Plugin | Kirki |
Version | 0.7 |
Comparing to | |
See all releases |
Code changes from version 0.6.2 to 0.7
- README.md +0 -96
- assets/css/customizer.css +0 -5
- includes/class-kirki-controls.php +243 -114
- includes/class-kirki-customize-control.php +0 -24
- includes/class-kirki-fonts.php +4 -28
- includes/class-kirki-scripts.php +65 -14
- includes/class-kirki-settings.php +55 -44
- includes/class-kirki-style.php +42 -22
- includes/controls/class-kirki-customize-checkbox-control.php +0 -34
- includes/controls/class-kirki-customize-color-control.php +0 -83
- includes/controls/class-kirki-customize-group-title-control.php +5 -7
- includes/controls/class-kirki-customize-image-control.php +0 -193
- includes/controls/class-kirki-customize-multicheck-control.php +6 -8
- includes/controls/class-kirki-customize-number-control.php +5 -7
- includes/controls/class-kirki-customize-radio-buttonset-control.php +40 -0
- includes/controls/class-kirki-customize-radio-control.php +0 -85
- includes/controls/class-kirki-customize-radio-image-control.php +40 -0
- includes/controls/class-kirki-customize-select-control.php +0 -32
- includes/controls/class-kirki-customize-slider-control.php +6 -9
- includes/controls/class-kirki-customize-sortable-control.php +7 -9
- includes/controls/class-kirki-customize-switch-control.php +28 -0
- includes/controls/class-kirki-customize-text-control.php +0 -24
- includes/controls/class-kirki-customize-textarea-control.php +0 -23
- includes/controls/class-kirki-customize-toggle-control.php +27 -0
- includes/controls/class-kirki-customize-upload-control.php +0 -69
- kirki.php +86 -20
- readme.txt +44 -17
README.md
DELETED
@@ -1,96 +0,0 @@
|
|
1 |
-
=== Kirki ===
|
2 |
-
Contributors: aristath, fovoc
|
3 |
-
Donate link: http://kirki.org
|
4 |
-
Tags: customizer
|
5 |
-
Requires at least: 4.0
|
6 |
-
Tested up to: 4.1.1
|
7 |
-
Stable tag: 0.6.0
|
8 |
-
License: GPLv2 or later
|
9 |
-
License URI: http://www.gnu.org/licenses/gpl-2.0.html
|
10 |
-
|
11 |
-
Tired of all the bloated options frameworks? You can use the WordPress Customizer instead, and extend it using Kirki!
|
12 |
-
|
13 |
-
== Description ==
|
14 |
-
|
15 |
-
Kirki allows developers to add advanced controls to their customizer as well as customize the way the customizer looks and feels.
|
16 |
-
|
17 |
-
The following controls are included:
|
18 |
-
|
19 |
-
* Buttonset
|
20 |
-
* Checkbox
|
21 |
-
* Color
|
22 |
-
* Image
|
23 |
-
* Background
|
24 |
-
* Image Radio
|
25 |
-
* Multicheck
|
26 |
-
* Radio
|
27 |
-
* Select
|
28 |
-
* Slider
|
29 |
-
* Text
|
30 |
-
* Textarea
|
31 |
-
* Upload
|
32 |
-
* Switch
|
33 |
-
* Toggle
|
34 |
-
* Sortable
|
35 |
-
|
36 |
-
For documentation and examples on how to use these controls, please visit [kirki.org](http://kirki.org/#fields).
|
37 |
-
|
38 |
-
In addition you can also automatically generate the CSS for a lot of controls and have it added to the head of your document without writing any custom functions and code for that. [Learn more about automatic output of CSS here](http://kirki.org/#output)
|
39 |
-
|
40 |
-
== Installation ==
|
41 |
-
|
42 |
-
Just install this plugin and activate it.
|
43 |
-
For configuration instructions please visit http://kirki.org/#configuration
|
44 |
-
|
45 |
-
== 0.6.1 - 2012-02-25, dev time: 1 hours==
|
46 |
-
* Fix: Sortables controls had a JS conflict
|
47 |
-
* Fix: Switches & Toggles were not properly working
|
48 |
-
|
49 |
-
== 0.6.0 - 2012-02-25, dev time: 9 hours==
|
50 |
-
* Fix: Tooltips now properly working
|
51 |
-
* New: Added checkbox switches
|
52 |
-
* New: Added checkbox toggles
|
53 |
-
* Fix: Generated CSS is not properly combined & minified
|
54 |
-
* Fix: Re-structuring files hierarchy
|
55 |
-
* Fix: Simplify the way controls are loaded
|
56 |
-
* New: Only load control classes when they are needed
|
57 |
-
* New: Introducing Kirki_Customize_Control class
|
58 |
-
* Fix: CSS tweaks
|
59 |
-
* New: Sortable control (creating one is identical to a select control, but with `'type' => 'sortable'`)
|
60 |
-
* Fix: Double output CSS (props @agusmu)
|
61 |
-
* New: Google fonts now parsed from a json file.
|
62 |
-
|
63 |
-
== 0.5.1 ==
|
64 |
-
* Fix: Transport defaults to refresh instead of postMessage
|
65 |
-
* Fix: undefined index notice.
|
66 |
-
|
67 |
-
== 0.5 ==
|
68 |
-
* New: Automatic output of styles for generic controls.
|
69 |
-
* New: Automatic output of styles + scripts for fonts (including googlefonts )
|
70 |
-
* New: The 'output' argument on background controls is now an array for consistency with other controls. Older syntax is still compatible though. :)
|
71 |
-
* New: Add the ability to auto-generate styles for colors.
|
72 |
-
* Fix: Add a blank stylesheet if we need one and no stylesheet_id has been defined in the config options.
|
73 |
-
* Fix: CSS-only tooltips. Fixes issue with tooltips now showing up on WP >= 4.1
|
74 |
-
* Fix: Code cleanups
|
75 |
-
* New: Added support for WordPress's transport arguments
|
76 |
-
* Fix: All controls now have a sanitization callback. Users can override the default sanitizations by adding their own 'sanitize_callback' argument.
|
77 |
-
* Fix: OOP rewrite
|
78 |
-
* Fix: Strip protocol from Google API link
|
79 |
-
* Fix: Loading order for some files
|
80 |
-
* Fix: Removed deprecated less_var argument
|
81 |
-
|
82 |
-
= 0.4 =
|
83 |
-
* Fix: bugfix for selector
|
84 |
-
* New: Change the Kirki theme based on which admin theme is selected.
|
85 |
-
* Fix: Tranlsation domain issue
|
86 |
-
* New: Added a "group_title" control
|
87 |
-
* Fix: Updated the required script
|
88 |
-
* Fix: Updating CSS
|
89 |
-
* Other minor improvements and bugfixes
|
90 |
-
|
91 |
-
= 0.3 =
|
92 |
-
* new: added background field
|
93 |
-
* new: added 'output' argument to directly output the CSS
|
94 |
-
|
95 |
-
= 0.2 =
|
96 |
-
* Initial version
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
assets/css/customizer.css
CHANGED
@@ -45,11 +45,6 @@ li .image.ui-buttonset label.ui-button {
|
|
45 |
margin-right: 15px;
|
46 |
}
|
47 |
|
48 |
-
.customizer-subtitle {
|
49 |
-
font-size: 0.9em;
|
50 |
-
margin-bottom: 5px;
|
51 |
-
}
|
52 |
-
|
53 |
div.kirki-customizer {
|
54 |
height: 80px;
|
55 |
}
|
45 |
margin-right: 15px;
|
46 |
}
|
47 |
|
|
|
|
|
|
|
|
|
|
|
48 |
div.kirki-customizer {
|
49 |
height: 80px;
|
50 |
}
|
includes/class-kirki-controls.php
CHANGED
@@ -1,139 +1,268 @@
|
|
1 |
<?php
|
2 |
|
3 |
|
4 |
-
class Kirki_Controls
|
5 |
|
6 |
-
function
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
7 |
|
8 |
-
$control['label'] = isset( $control['label'] ) ? $control['label'] : '';
|
9 |
-
$control['settings'] = $control['setting'];
|
10 |
-
$control['description'] = isset( $control['description'] ) ? $control['description'] : null;
|
11 |
-
$control['subtitle'] = isset( $control['subtitle'] ) ? $control['subtitle'] : '';
|
12 |
$control['required'] = isset( $control['required'] ) ? $control['required'] : array();
|
13 |
$control['transport'] = isset( $control['transport'] ) ? $control['transport'] : 'refresh';
|
14 |
-
$control['default'] = 'sortable' == $control['type'] ? maybe_serialize( $control['default'] ) : $control['default'];
|
15 |
|
16 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
17 |
|
18 |
-
|
19 |
-
|
20 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
21 |
|
22 |
-
|
|
|
|
|
|
|
23 |
|
|
|
|
|
24 |
/**
|
25 |
* The background control is a multi-control element
|
26 |
* so it requires extra steps to be created
|
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 |
-
|
104 |
-
|
105 |
-
|
106 |
-
|
107 |
-
|
108 |
-
'
|
109 |
-
'
|
110 |
-
'
|
111 |
-
'
|
112 |
-
|
113 |
-
|
114 |
-
|
115 |
-
|
116 |
-
|
117 |
-
|
118 |
-
|
119 |
-
|
120 |
-
|
121 |
-
|
122 |
-
|
123 |
-
|
124 |
-
|
125 |
-
|
126 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
127 |
'section' => $control['section'],
|
128 |
-
'settings' => $control['
|
129 |
'priority' => $control['priority'] + 6,
|
130 |
'choices' => array(
|
131 |
'min' => 0,
|
132 |
'max' => 100,
|
133 |
'step' => 1,
|
134 |
),
|
135 |
-
'
|
136 |
-
'
|
137 |
'required' => $control['required'],
|
138 |
'transport' => $control['transport']
|
139 |
) ) );
|
1 |
<?php
|
2 |
|
3 |
|
4 |
+
class Kirki_Controls {
|
5 |
|
6 |
+
public static function control_clean( $control ) {
|
7 |
+
|
8 |
+
/**
|
9 |
+
* Compatibility tweak
|
10 |
+
*
|
11 |
+
* Previous verions of the Kirki Customizer had the 'description' field mapped to the new 'help'
|
12 |
+
* and instead of 'description' we were using 'subtitle'.
|
13 |
+
* This has been deprecated in favor of WordPress core's 'description' field that was recently introduced.
|
14 |
+
*
|
15 |
+
*/
|
16 |
+
if ( isset( $control['subtitle'] ) ) {
|
17 |
+
// Use old arguments form.
|
18 |
+
$control['help'] = ( isset( $control['description'] ) ) ? $control['description'] : '';
|
19 |
+
$control['description'] = $control['subtitle'];
|
20 |
+
}
|
21 |
+
$control['description'] = isset( $control['description'] ) ? $control['description'] : '';
|
22 |
+
$control['help'] = isset( $control['help'] ) ? $control['help'] : '';
|
23 |
+
|
24 |
+
$control['label'] = isset( $control['label'] ) ? $control['label'] : '';
|
25 |
+
|
26 |
+
/**
|
27 |
+
* Compatibility tweak
|
28 |
+
*
|
29 |
+
* Previous versions of the Kirki customizer used 'setting' istead of 'settings'.
|
30 |
+
*/
|
31 |
+
if ( ! isset( $control['settings'] ) && isset( $control['setting'] ) ) {
|
32 |
+
$control['settings'] = $control['setting'];
|
33 |
+
}
|
34 |
|
|
|
|
|
|
|
|
|
35 |
$control['required'] = isset( $control['required'] ) ? $control['required'] : array();
|
36 |
$control['transport'] = isset( $control['transport'] ) ? $control['transport'] : 'refresh';
|
|
|
37 |
|
38 |
+
/**
|
39 |
+
* Sortable controls need a serialized array as the default value.
|
40 |
+
* Since we're using normal arrays to set our defaults when defining the fields, we need to serialize that value here.
|
41 |
+
*/
|
42 |
+
if ( 'sortable' == $control['type'] && isset( $control['default'] ) && ! empty( $control['default'] ) ) {
|
43 |
+
$control['default'] = maybe_serialize( $control['default'] );
|
44 |
+
}
|
45 |
+
|
46 |
+
return $control;
|
47 |
|
48 |
+
}
|
49 |
+
|
50 |
+
function add_control( $wp_customize, $control ) {
|
51 |
+
|
52 |
+
$control = self::control_clean( $control );
|
53 |
+
|
54 |
+
/**
|
55 |
+
* Add our fields.
|
56 |
+
* We use the default WordPress Core Customizer fields when possible
|
57 |
+
* and only add our own custom controls when needed.
|
58 |
+
*/
|
59 |
+
|
60 |
+
// Color controls
|
61 |
+
if ( 'color' == $control['type'] ) {
|
62 |
+
$wp_customize->add_control( new WP_Customize_Color_Control( $wp_customize, $control['settings'] . '_color', $control ) );
|
63 |
+
}
|
64 |
+
|
65 |
+
// Image Controls
|
66 |
+
elseif ( 'image' == $control['type'] ) {
|
67 |
+
$wp_customize->add_control( new WP_Customize_Image_Control( $wp_customize, $control['settings'] . '_color', $control ) );
|
68 |
+
}
|
69 |
+
|
70 |
+
// Text, Dropdown Pages, Textarea and Select controls
|
71 |
+
elseif ( in_array( $control['type'], array( 'text', 'dropdown-pages', 'textarea', 'select' ) ) ) {
|
72 |
+
$wp_customize->add_control( new WP_Customize_Control( $wp_customize, $control['settings'], $control ) );
|
73 |
+
}
|
74 |
+
|
75 |
+
// Upload Controls
|
76 |
+
elseif ( 'upload' == $control['type'] ) {
|
77 |
+
$wp_customize->add_control( new WP_Customize_Upload_Control( $wp_customize, $control['settings'], $control ) );
|
78 |
+
}
|
79 |
+
|
80 |
+
// Switch Controls
|
81 |
+
elseif ( 'switch' == $control['type'] || ( 'checkbox' == $control['type'] && isset( $control['mode'] ) && 'switch' == $control['mode'] ) ) {
|
82 |
+
$wp_customize->add_control( new Kirki_Customize_Switch_Control( $wp_customize, $control['settings'], $control ) );
|
83 |
+
}
|
84 |
+
|
85 |
+
// Toggle Controls
|
86 |
+
elseif ( 'toggle' == $control['type'] || ( 'checkbox' == $control['type'] && isset( $control['mode'] ) && 'toggle' == $control['mode'] ) ) {
|
87 |
+
$wp_customize->add_control( new Kirki_Customize_Toggle_Control( $wp_customize, $control['settings'], $control ) );
|
88 |
+
}
|
89 |
+
|
90 |
+
// Checkbox Controls
|
91 |
+
elseif ( 'checkbox' == $control['type'] ) {
|
92 |
+
$wp_customize->add_control( new WP_Customize_Control( $wp_customize, $control['settings'], $control ) );
|
93 |
+
}
|
94 |
+
|
95 |
+
// Radio-Buttonset Controls
|
96 |
+
elseif ( 'radio-buttonset' == $control['type'] || ( 'radio' == $control['type'] && isset( $control['mode'] ) && 'buttonset' == $control['mode'] ) ) {
|
97 |
+
$wp_customize->add_control( new Kirki_Customize_Radio_Buttonset_Control( $wp_customize, $control['settings'], $control ) );
|
98 |
+
}
|
99 |
+
|
100 |
+
// Radio-Image Controls
|
101 |
+
elseif ( 'radio-image' == $control['type'] || ( 'radio' == $control['type'] && isset( $control['mode'] ) && 'image' == $control['mode'] ) ) {
|
102 |
+
$wp_customize->add_control( new Kirki_Customize_Radio_Image_Control( $wp_customize, $control['settings'], $control ) );
|
103 |
+
}
|
104 |
+
|
105 |
+
// Radio Controls
|
106 |
+
elseif ( 'radio' == $control['type'] ) {
|
107 |
+
$wp_customize->add_control( new WP_Customize_Control( $wp_customize, $control['settings'], $control ) );
|
108 |
+
}
|
109 |
+
|
110 |
+
// Sortable Controls
|
111 |
+
elseif ( 'sortable' == $control['type'] ) {
|
112 |
+
$wp_customize->add_control( new Kirki_Customize_Sortable_Control( $wp_customize, $control['settings'], $control ) );
|
113 |
+
}
|
114 |
+
|
115 |
+
// Slider Controls
|
116 |
+
elseif ( 'slider' == $control['type'] ) {
|
117 |
+
$wp_customize->add_control( new Kirki_Customize_Slider_Control( $wp_customize, $control['settings'], $control ) );
|
118 |
+
}
|
119 |
+
|
120 |
+
// Number Controls
|
121 |
+
elseif ( 'number' == $control['type'] ) {
|
122 |
+
$wp_customize->add_control( new Kirki_Customize_Number_Control( $wp_customize, $control['settings'], $control ) );
|
123 |
+
}
|
124 |
+
|
125 |
+
// Multicheck Controls
|
126 |
+
elseif ( 'multicheck' == $control['type'] ) {
|
127 |
+
$wp_customize->add_control( new Kirki_Customize_Multicheck_Control( $wp_customize, $control['settings'], $control ) );
|
128 |
+
}
|
129 |
|
130 |
+
// Group-Title Controls
|
131 |
+
elseif ( 'group-title' == $control['type'] ) {
|
132 |
+
$wp_customize->add_control( new Kirki_Customize_Group_Title_Control( $wp_customize, $control['settings'], $control ) );
|
133 |
+
}
|
134 |
|
135 |
+
// Background Controls
|
136 |
+
elseif ( 'background' == $control['type'] ) {
|
137 |
/**
|
138 |
* The background control is a multi-control element
|
139 |
* so it requires extra steps to be created
|
140 |
*/
|
141 |
+
if ( isset( $control['default']['color'] ) ) {
|
142 |
+
$wp_customize->add_control( new WP_Customize_Color_Control( $wp_customize, $control['settings'] . '_color', array(
|
143 |
+
'label' => isset( $control['label'] ) ? $control['label'] : '',
|
144 |
+
'section' => $control['section'],
|
145 |
+
'settings' => $control['settings'] . '_color',
|
146 |
+
'priority' => $control['priority'],
|
147 |
+
'help' => $control['help'],
|
148 |
+
'description' => __( 'Background Color', 'kirki' ),
|
149 |
+
'required' => $control['required'],
|
150 |
+
'transport' => $control['transport']
|
151 |
+
) ) );
|
152 |
+
}
|
153 |
+
|
154 |
+
if ( isset( $control['default']['image'] ) ) {
|
155 |
+
$wp_customize->add_control( new WP_Customize_Image_Control( $wp_customize, $control['settings'] . '_image', array(
|
156 |
+
'label' => '',
|
157 |
+
'section' => $control['section'],
|
158 |
+
'settings' => $control['settings'] . '_image',
|
159 |
+
'priority' => $control['priority'] + 1,
|
160 |
+
'help' => '',
|
161 |
+
'description' => __( 'Background Image', 'kirki' ),
|
162 |
+
'required' => $control['required'],
|
163 |
+
'transport' => $control['transport']
|
164 |
+
) ) );
|
165 |
+
}
|
166 |
+
|
167 |
+
if ( isset( $control['default']['repeat'] ) ) {
|
168 |
+
$wp_customize->add_control( $control['settings'] . '_repeat', array(
|
169 |
+
'type' => 'select',
|
170 |
+
'label' => '',
|
171 |
+
'section' => $control['section'],
|
172 |
+
'settings' => $control['settings'] . '_repeat',
|
173 |
+
'priority' => $control['priority'] + 2,
|
174 |
+
'choices' => array(
|
175 |
+
'no-repeat' => __( 'No Repeat', 'kirki' ),
|
176 |
+
'repeat' => __( 'Repeat All', 'kirki' ),
|
177 |
+
'repeat-x' => __( 'Repeat Horizontally', 'kirki' ),
|
178 |
+
'repeat-y' => __( 'Repeat Vertically', 'kirki' ),
|
179 |
+
'inherit' => __( 'Inherit', 'kirki' )
|
180 |
+
),
|
181 |
+
'help' => '',
|
182 |
+
'description' => __( 'Background Repeat', 'kirki' ),
|
183 |
+
'required' => $control['required'],
|
184 |
+
'transport' => $control['transport']
|
185 |
+
) );
|
186 |
+
}
|
187 |
+
|
188 |
+
if ( isset( $control['default']['size'] ) ) {
|
189 |
+
$wp_customize->add_control( $control['settings'] . '_size', array(
|
190 |
+
'type' => 'radio',
|
191 |
+
'label' => '',
|
192 |
+
'section' => $control['section'],
|
193 |
+
'settings' => $control['settings'] . '_size',
|
194 |
+
'priority' => $control['priority'] + 3,
|
195 |
+
'choices' => array(
|
196 |
+
'inherit' => __( 'Inherit', 'kirki' ),
|
197 |
+
'cover' => __( 'Cover', 'kirki' ),
|
198 |
+
'contain' => __( 'Contain', 'kirki' ),
|
199 |
+
),
|
200 |
+
'help' => '',
|
201 |
+
'mode' => 'buttonset',
|
202 |
+
'description' => __( 'Background Size', 'kirki' ),
|
203 |
+
'required' => $control['required'],
|
204 |
+
'transport' => $control['transport']
|
205 |
+
) );
|
206 |
+
}
|
207 |
+
|
208 |
+
if ( isset( $control['default']['attach'] ) ) {
|
209 |
+
$wp_customize->add_control( $control['settings'] . '_attach', array(
|
210 |
+
'label' => '',
|
211 |
+
'type' => 'radio',
|
212 |
+
'section' => $control['section'],
|
213 |
+
'settings' => $control['settings'] . '_attach',
|
214 |
+
'priority' => $control['priority'] + 4,
|
215 |
+
'choices' => array(
|
216 |
+
'inherit' => __( 'Inherit', 'kirki' ),
|
217 |
+
'fixed' => __( 'Fixed', 'kirki' ),
|
218 |
+
'scroll' => __( 'Scroll', 'kirki' ),
|
219 |
+
),
|
220 |
+
'help' => '',
|
221 |
+
'mode' => 'buttonset',
|
222 |
+
'description' => __( 'Background Attachment', 'kirki' ),
|
223 |
+
'required' => $control['required'],
|
224 |
+
'transport' => $control['transport']
|
225 |
+
) );
|
226 |
+
}
|
227 |
+
|
228 |
+
if ( isset( $control['default']['position'] ) ) {
|
229 |
+
$wp_customize->add_control( $control['settings'] . '_position', array(
|
230 |
+
'type' => 'select',
|
231 |
+
'label' => '',
|
232 |
+
'section' => $control['section'],
|
233 |
+
'settings' => $control['settings'] . '_position',
|
234 |
+
'priority' => $control['priority'] + 5,
|
235 |
+
'choices' => array(
|
236 |
+
'left-top' => __( 'Left Top', 'kirki' ),
|
237 |
+
'left-center' => __( 'Left Center', 'kirki' ),
|
238 |
+
'left-bottom' => __( 'Left Bottom', 'kirki' ),
|
239 |
+
'right-top' => __( 'Right Top', 'kirki' ),
|
240 |
+
'right-center' => __( 'Right Center', 'kirki' ),
|
241 |
+
'right-bottom' => __( 'Right Bottom', 'kirki' ),
|
242 |
+
'center-top' => __( 'Center Top', 'kirki' ),
|
243 |
+
'center-center' => __( 'Center Center', 'kirki' ),
|
244 |
+
'center-bottom' => __( 'Center Bottom', 'kirki' ),
|
245 |
+
),
|
246 |
+
'help' => '',
|
247 |
+
'description' => __( 'Background Position', 'kirki' ),
|
248 |
+
'required' => $control['required'],
|
249 |
+
'transport' => $control['transport']
|
250 |
+
) );
|
251 |
+
}
|
252 |
+
|
253 |
+
if ( isset( $control['default']['opacity'] ) && $control['default']['opacity'] ) {
|
254 |
+
$wp_customize->add_control( new Kirki_Customize_Slider_Control( $wp_customize, $control['settings'] . '_opacity', array(
|
255 |
+
'label' => '',
|
256 |
'section' => $control['section'],
|
257 |
+
'settings' => $control['settings'] . '_opacity',
|
258 |
'priority' => $control['priority'] + 6,
|
259 |
'choices' => array(
|
260 |
'min' => 0,
|
261 |
'max' => 100,
|
262 |
'step' => 1,
|
263 |
),
|
264 |
+
'help' => '',
|
265 |
+
'description' => __( 'Background Opacity', 'kirki' ),
|
266 |
'required' => $control['required'],
|
267 |
'transport' => $control['transport']
|
268 |
) ) );
|
includes/class-kirki-customize-control.php
DELETED
@@ -1,24 +0,0 @@
|
|
1 |
-
<?php
|
2 |
-
|
3 |
-
class Kirki_Customize_Control extends WP_Customize_Control {
|
4 |
-
public $type;
|
5 |
-
public $description;
|
6 |
-
public $mode;
|
7 |
-
public $subtitle;
|
8 |
-
|
9 |
-
public function __construct( $manager, $id, $args = array() ) {
|
10 |
-
parent::__construct( $manager, $id, $args );
|
11 |
-
}
|
12 |
-
|
13 |
-
public function description() { ?>
|
14 |
-
<?php if ( isset( $this->description ) && '' != $this->description ) : ?>
|
15 |
-
<a href="#" class="button tooltip hint--left" data-hint="<?php echo strip_tags( esc_html( $this->description ) ); ?>">?</a>
|
16 |
-
<?php endif;
|
17 |
-
}
|
18 |
-
|
19 |
-
public function subtitle() { ?>
|
20 |
-
<?php if ( '' != $this->subtitle ) : ?>
|
21 |
-
<div class="customizer-subtitle"><?php echo $this->subtitle; ?></div>
|
22 |
-
<?php endif;
|
23 |
-
}
|
24 |
-
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
includes/class-kirki-fonts.php
CHANGED
@@ -93,41 +93,26 @@ class Kirki_Fonts {
|
|
93 |
}
|
94 |
|
95 |
// load the font weight
|
96 |
-
|
97 |
-
|
98 |
-
$weight = implode( ',', $weight );
|
99 |
-
|
100 |
-
}
|
101 |
-
|
102 |
-
$request .= ':' . $weight;
|
103 |
|
104 |
// Load the font subset
|
105 |
if ( 'all' === $subset ) {
|
106 |
|
107 |
$subsets_available = self::get_google_font_subsets();
|
108 |
-
|
109 |
// Remove the all set
|
110 |
unset( $subsets_available['all'] );
|
111 |
-
|
112 |
// Build the array
|
113 |
$subsets = array_keys( $subsets_available );
|
114 |
|
115 |
} else {
|
116 |
|
117 |
-
$subsets = array
|
118 |
-
'latin',
|
119 |
-
$subset,
|
120 |
-
|
121 |
-
);
|
122 |
|
123 |
}
|
124 |
|
125 |
// Append the subset string
|
126 |
-
|
127 |
-
|
128 |
-
$request .= urlencode( '&subset=' . join( ',', $subsets ) );
|
129 |
-
|
130 |
-
}
|
131 |
|
132 |
return esc_url( $request );
|
133 |
|
@@ -172,7 +157,6 @@ class Kirki_Fonts {
|
|
172 |
if ( empty( $variants ) ) {
|
173 |
|
174 |
$fonts = self::get_google_fonts();
|
175 |
-
|
176 |
if ( array_key_exists( $font, $fonts ) ) {
|
177 |
$variants = $fonts[ $font ]['variants'];
|
178 |
}
|
@@ -181,27 +165,19 @@ class Kirki_Fonts {
|
|
181 |
|
182 |
// If a "regular" variant is not found, get the first variant
|
183 |
if ( ! in_array( 'regular', $variants ) ) {
|
184 |
-
|
185 |
$chosen_variants[] = $variants[0];
|
186 |
-
|
187 |
} else {
|
188 |
-
|
189 |
$chosen_variants[] = 'regular';
|
190 |
-
|
191 |
}
|
192 |
|
193 |
// Only add "italic" if it exists
|
194 |
if ( in_array( 'italic', $variants ) ) {
|
195 |
-
|
196 |
$chosen_variants[] = 'italic';
|
197 |
-
|
198 |
}
|
199 |
|
200 |
// Only add "700" if it exists
|
201 |
if ( in_array( '700', $variants ) ) {
|
202 |
-
|
203 |
$chosen_variants[] = '700';
|
204 |
-
|
205 |
}
|
206 |
|
207 |
return apply_filters( 'kirki/font/variants', array_unique( $chosen_variants ), $font, $variants );
|
93 |
}
|
94 |
|
95 |
// load the font weight
|
96 |
+
$weight = ( is_array( $weight ) ) ? implode( ',', $weight ) : $weight;
|
97 |
+
$request .= $weight;
|
|
|
|
|
|
|
|
|
|
|
98 |
|
99 |
// Load the font subset
|
100 |
if ( 'all' === $subset ) {
|
101 |
|
102 |
$subsets_available = self::get_google_font_subsets();
|
|
|
103 |
// Remove the all set
|
104 |
unset( $subsets_available['all'] );
|
|
|
105 |
// Build the array
|
106 |
$subsets = array_keys( $subsets_available );
|
107 |
|
108 |
} else {
|
109 |
|
110 |
+
$subsets = (array)$subset;
|
|
|
|
|
|
|
|
|
111 |
|
112 |
}
|
113 |
|
114 |
// Append the subset string
|
115 |
+
$request .= ( ! empty( $subsets ) ) ? '&subset=' . join( ',', $subsets ) : '';
|
|
|
|
|
|
|
|
|
116 |
|
117 |
return esc_url( $request );
|
118 |
|
157 |
if ( empty( $variants ) ) {
|
158 |
|
159 |
$fonts = self::get_google_fonts();
|
|
|
160 |
if ( array_key_exists( $font, $fonts ) ) {
|
161 |
$variants = $fonts[ $font ]['variants'];
|
162 |
}
|
165 |
|
166 |
// If a "regular" variant is not found, get the first variant
|
167 |
if ( ! in_array( 'regular', $variants ) ) {
|
|
|
168 |
$chosen_variants[] = $variants[0];
|
|
|
169 |
} else {
|
|
|
170 |
$chosen_variants[] = 'regular';
|
|
|
171 |
}
|
172 |
|
173 |
// Only add "italic" if it exists
|
174 |
if ( in_array( 'italic', $variants ) ) {
|
|
|
175 |
$chosen_variants[] = 'italic';
|
|
|
176 |
}
|
177 |
|
178 |
// Only add "700" if it exists
|
179 |
if ( in_array( '700', $variants ) ) {
|
|
|
180 |
$chosen_variants[] = '700';
|
|
|
181 |
}
|
182 |
|
183 |
return apply_filters( 'kirki/font/variants', array_unique( $chosen_variants ), $font, $variants );
|
includes/class-kirki-scripts.php
CHANGED
@@ -2,20 +2,34 @@
|
|
2 |
|
3 |
class Kirki_Scripts {
|
4 |
|
5 |
-
|
|
|
|
|
|
|
|
|
|
|
6 |
|
7 |
add_action( 'customize_controls_print_styles', array( $this, 'styles' ) );
|
8 |
add_action( 'customize_controls_print_styles', array( $this, 'googlefonts' ) );
|
9 |
add_action( 'customize_controls_print_scripts', array( $this, 'custom_js' ), 999 );
|
|
|
10 |
add_action( 'customize_controls_print_styles', array( $this, 'custom_css' ), 999 );
|
11 |
// TODO: This is not perfect under ANY circumstances.
|
12 |
add_action( 'customize_controls_print_footer_scripts', array( $this, 'postmessage' ), 21 );
|
13 |
|
14 |
-
add_action( 'wp_enqueue_scripts', array( $this, 'frontend_styles' ) );
|
15 |
add_action( 'customize_controls_enqueue_scripts', array( $this, 'scripts' ) );
|
16 |
|
17 |
}
|
18 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
19 |
/**
|
20 |
* Enqueue the stylesheets required.
|
21 |
*/
|
@@ -58,7 +72,7 @@ class Kirki_Scripts {
|
|
58 |
global $kirki;
|
59 |
$config = $kirki->get_config();
|
60 |
$controls = $kirki->get_controls();
|
61 |
-
|
62 |
$kirki_url = isset( $options['url_path'] ) ? $options['url_path'] : KIRKI_URL;
|
63 |
|
64 |
foreach( $controls as $control ) {
|
@@ -301,17 +315,54 @@ class Kirki_Scripts {
|
|
301 |
}
|
302 |
|
303 |
/**
|
304 |
-
|
305 |
-
|
306 |
-
|
307 |
-
|
308 |
-
|
309 |
-
|
310 |
-
|
311 |
-
|
312 |
-
|
313 |
-
|
314 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
315 |
function postmessage() {
|
316 |
|
317 |
global $kirki;
|
2 |
|
3 |
class Kirki_Scripts {
|
4 |
|
5 |
+
private static $instance;
|
6 |
+
|
7 |
+
protected function __construct() {
|
8 |
+
|
9 |
+
$config = apply_filters( 'kirki/config', array() );
|
10 |
+
$styles_priority = ( isset( $options['styles_priority'] ) ) ? $styles_priority : 10;
|
11 |
|
12 |
add_action( 'customize_controls_print_styles', array( $this, 'styles' ) );
|
13 |
add_action( 'customize_controls_print_styles', array( $this, 'googlefonts' ) );
|
14 |
add_action( 'customize_controls_print_scripts', array( $this, 'custom_js' ), 999 );
|
15 |
+
add_action( 'customize_controls_print_footer_scripts', array( $this, 'help_bubble_script' ), 999 );
|
16 |
add_action( 'customize_controls_print_styles', array( $this, 'custom_css' ), 999 );
|
17 |
// TODO: This is not perfect under ANY circumstances.
|
18 |
add_action( 'customize_controls_print_footer_scripts', array( $this, 'postmessage' ), 21 );
|
19 |
|
20 |
+
add_action( 'wp_enqueue_scripts', array( $this, 'frontend_styles' ), $styles_priority );
|
21 |
add_action( 'customize_controls_enqueue_scripts', array( $this, 'scripts' ) );
|
22 |
|
23 |
}
|
24 |
|
25 |
+
public static function get_instance() {
|
26 |
+
if ( null == self::$instance ) {
|
27 |
+
self::$instance = new self;
|
28 |
+
}
|
29 |
+
|
30 |
+
return self::$instance;
|
31 |
+
}
|
32 |
+
|
33 |
/**
|
34 |
* Enqueue the stylesheets required.
|
35 |
*/
|
72 |
global $kirki;
|
73 |
$config = $kirki->get_config();
|
74 |
$controls = $kirki->get_controls();
|
75 |
+
|
76 |
$kirki_url = isset( $options['url_path'] ) ? $options['url_path'] : KIRKI_URL;
|
77 |
|
78 |
foreach( $controls as $control ) {
|
315 |
}
|
316 |
|
317 |
/**
|
318 |
+
* Add the help bubble
|
319 |
+
*/
|
320 |
+
function help_bubble_script() {
|
321 |
+
|
322 |
+
global $kirki;
|
323 |
+
$controls = $kirki->get_controls();
|
324 |
+
|
325 |
+
$scripts = array();
|
326 |
+
$script = '';
|
327 |
+
|
328 |
+
foreach ( $controls as $control ) {
|
329 |
+
|
330 |
+
$control = Kirki_Controls::control_clean( $control );
|
331 |
+
|
332 |
+
if ( ! empty( $control['help'] ) ) {
|
333 |
+
$bubble_content = $control['help'];
|
334 |
+
$content = "<a href='#' class='button tooltip hint--left' data-hint='" . strip_tags( esc_html( $bubble_content ) ) . "'>?</a>";
|
335 |
+
$scripts[] = '$( "' . $content . '" ).appendTo( "#customize-control-' . $control['settings'] . '" );';
|
336 |
+
}
|
337 |
+
|
338 |
+
}
|
339 |
+
|
340 |
+
// No need to echo anything if the script is empty
|
341 |
+
if ( empty( $scripts ) ) {
|
342 |
+
return;
|
343 |
+
}
|
344 |
+
|
345 |
+
// Make sure we don't add any duplicates
|
346 |
+
$scripts = array_unique( $scripts );
|
347 |
+
// Convert array to string
|
348 |
+
$script = implode( '', $scripts );
|
349 |
+
|
350 |
+
echo '<script type="text/javascript">jQuery(document).ready(function( $ ) {' . $script . '});</script>';
|
351 |
+
}
|
352 |
+
|
353 |
+
/**
|
354 |
+
* Try to automatically generate the script necessary for postMessage to work.
|
355 |
+
* Something like this will have to be added to the control arguments:
|
356 |
+
*
|
357 |
+
|
358 |
+
'transport' => 'postMessage',
|
359 |
+
'js_vars' => array(
|
360 |
+
'element' => 'body',
|
361 |
+
'type' => 'css',
|
362 |
+
'property' => 'color',
|
363 |
+
),
|
364 |
+
*
|
365 |
+
*/
|
366 |
function postmessage() {
|
367 |
|
368 |
global $kirki;
|
includes/class-kirki-settings.php
CHANGED
@@ -10,56 +10,67 @@ class Kirki_Settings extends Kirki {
|
|
10 |
|
11 |
if ( 'background' == $control['type'] ) {
|
12 |
|
13 |
-
|
14 |
-
|
15 |
-
|
16 |
-
|
17 |
-
|
18 |
-
|
19 |
-
|
20 |
-
|
21 |
-
|
22 |
-
'default' => $control['default']['image'],
|
23 |
-
'type' => 'theme_mod',
|
24 |
-
'capability' => 'edit_theme_options',
|
25 |
-
'transport' => isset( $control['transport'] ) ? $control['transport'] : 'refresh',
|
26 |
-
'sanitize_callback' => isset( $control['sanitize_callback'] ) ? $control['sanitize_callback'] : 'esc_url_raw'
|
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 |
-
if (
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
62 |
|
|
|
63 |
$wp_customize->add_setting( $control['setting'] . '_opacity', array(
|
64 |
'default' => $control['default']['opacity'],
|
65 |
'type' => 'theme_mod',
|
10 |
|
11 |
if ( 'background' == $control['type'] ) {
|
12 |
|
13 |
+
if ( isset( $control['default']['color'] ) ) {
|
14 |
+
$wp_customize->add_setting( $control['setting'] . '_color', array(
|
15 |
+
'default' => $control['default']['color'],
|
16 |
+
'type' => 'theme_mod',
|
17 |
+
'capability' => 'edit_theme_options',
|
18 |
+
'transport' => isset( $control['transport'] ) ? $control['transport'] : 'refresh',
|
19 |
+
'sanitize_callback' => isset( $control['sanitize_callback'] ) ? $control['sanitize_callback'] : 'sanitize_hex_color'
|
20 |
+
) );
|
21 |
+
}
|
|
|
|
|
|
|
|
|
|
|
|
|
22 |
|
23 |
+
if ( isset( $control['default']['image'] ) ) {
|
24 |
+
$wp_customize->add_setting( $control['setting'] . '_image', array(
|
25 |
+
'default' => $control['default']['image'],
|
26 |
+
'type' => 'theme_mod',
|
27 |
+
'capability' => 'edit_theme_options',
|
28 |
+
'transport' => isset( $control['transport'] ) ? $control['transport'] : 'refresh',
|
29 |
+
'sanitize_callback' => isset( $control['sanitize_callback'] ) ? $control['sanitize_callback'] : 'esc_url_raw'
|
30 |
+
) );
|
31 |
+
}
|
32 |
|
33 |
+
if ( isset( $control['default']['repeat'] ) ) {
|
34 |
+
$wp_customize->add_setting( $control['setting'] . '_repeat', array(
|
35 |
+
'default' => $control['default']['repeat'],
|
36 |
+
'type' => 'theme_mod',
|
37 |
+
'capability' => 'edit_theme_options',
|
38 |
+
'transport' => isset( $control['transport'] ) ? $control['transport'] : 'refresh',
|
39 |
+
'sanitize_callback' => isset( $control['sanitize_callback'] ) ? $control['sanitize_callback'] : array( $this, 'sanitize_bg_repeat' ),
|
40 |
+
) );
|
41 |
+
}
|
42 |
|
43 |
+
if ( isset( $control['default']['size'] ) ) {
|
44 |
+
$wp_customize->add_setting( $control['setting'] . '_size', array(
|
45 |
+
'default' => $control['default']['size'],
|
46 |
+
'type' => 'theme_mod',
|
47 |
+
'capability' => 'edit_theme_options',
|
48 |
+
'transport' => isset( $control['transport'] ) ? $control['transport'] : 'refresh',
|
49 |
+
'sanitize_callback' => isset( $control['sanitize_callback'] ) ? $control['sanitize_callback'] : array( $this, 'sanitize_bg_size' ),
|
50 |
+
) );
|
51 |
+
}
|
52 |
|
53 |
+
if ( isset( $control['default']['attach'] ) ) {
|
54 |
+
$wp_customize->add_setting( $control['setting'] . '_attach', array(
|
55 |
+
'default' => $control['default']['attach'],
|
56 |
+
'type' => 'theme_mod',
|
57 |
+
'capability' => 'edit_theme_options',
|
58 |
+
'transport' => isset( $control['transport'] ) ? $control['transport'] : 'refresh',
|
59 |
+
'sanitize_callback' => isset( $control['sanitize_callback'] ) ? $control['sanitize_callback'] : array( $this, 'sanitize_bg_attach' ),
|
60 |
+
) );
|
61 |
+
}
|
62 |
|
63 |
+
if ( isset( $control['default']['position'] ) ) {
|
64 |
+
$wp_customize->add_setting( $control['setting'] . '_position', array(
|
65 |
+
'default' => $control['default']['position'],
|
66 |
+
'type' => 'theme_mod',
|
67 |
+
'capability' => 'edit_theme_options',
|
68 |
+
'transport' => isset( $control['transport'] ) ? $control['transport'] : 'refresh',
|
69 |
+
'sanitize_callback' => isset( $control['sanitize_callback'] ) ? $control['sanitize_callback'] : array( $this, 'sanitize_bg_position' ),
|
70 |
+
) );
|
71 |
+
}
|
72 |
|
73 |
+
if ( isset( $control['default']['opacity'] ) && $control['default']['opacity'] ) {
|
74 |
$wp_customize->add_setting( $control['setting'] . '_opacity', array(
|
75 |
'default' => $control['default']['opacity'],
|
76 |
'type' => 'theme_mod',
|
includes/class-kirki-style.php
CHANGED
@@ -82,32 +82,52 @@ class Kirki_Style {
|
|
82 |
// Background Controls
|
83 |
elseif ( 'background' == $control['type'] ) {
|
84 |
|
85 |
-
|
86 |
-
|
87 |
-
|
88 |
-
|
89 |
-
|
90 |
-
|
91 |
-
|
92 |
-
|
93 |
-
|
94 |
-
|
95 |
-
$
|
96 |
-
|
97 |
-
|
98 |
-
|
99 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
100 |
}
|
101 |
|
102 |
}
|
103 |
|
104 |
-
|
105 |
-
|
106 |
-
|
107 |
-
|
108 |
-
$styles[$element]['background-
|
109 |
-
$
|
110 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
111 |
}
|
112 |
|
113 |
}
|
82 |
// Background Controls
|
83 |
elseif ( 'background' == $control['type'] ) {
|
84 |
|
85 |
+
if ( isset( $control['default']['color'] ) ) {
|
86 |
+
$bg_color = Kirki_Color::sanitize_hex( get_theme_mod( $control['setting'] . '_color', $control['default']['color'] ) );
|
87 |
+
}
|
88 |
+
if ( isset( $control['default']['image'] ) ) {
|
89 |
+
$bg_image = get_theme_mod( $control['setting'] . '_image', $control['default']['image'] );
|
90 |
+
}
|
91 |
+
if ( isset( $control['default']['repeat'] ) ) {
|
92 |
+
$bg_repeat = get_theme_mod( $control['setting'] . '_repeat', $control['default']['repeat'] );
|
93 |
+
}
|
94 |
+
if ( isset( $control['default']['size'] ) ) {
|
95 |
+
$bg_size = get_theme_mod( $control['setting'] . '_size', $control['default']['size'] );
|
96 |
+
}
|
97 |
+
if ( isset( $control['default']['attach'] ) ) {
|
98 |
+
$bg_attach = get_theme_mod( $control['setting'] . '_attach', $control['default']['attach'] );
|
99 |
+
}
|
100 |
+
if ( isset( $control['default']['position'] ) ) {
|
101 |
+
$bg_position = get_theme_mod( $control['setting'] . '_position', $control['default']['position'] );
|
102 |
+
}
|
103 |
+
if ( isset( $control['default']['opacity'] ) && $control['default']['opacity'] ) {
|
104 |
+
$bg_opacity = get_theme_mod( $control['setting'] . '_opacity', $control['default']['opacity'] );
|
105 |
+
if ( isset( $bg_color ) ) {
|
106 |
+
// If we're using an opacity other than 100, then convert the color to RGBA.
|
107 |
+
$bg_color = ( 100 != $bg_opacity ) ? Kirki_Color::get_rgba( $bg_color, $bg_opacity ) : $bg_color;
|
108 |
+
} elseif ( isset( $bg_image ) ) {
|
109 |
+
$element_opacity = ( $bg_opacity / 100 );
|
110 |
}
|
111 |
|
112 |
}
|
113 |
|
114 |
+
if ( isset( $bg_color ) ) {
|
115 |
+
$styles[$element]['background-color'] = $bg_color;
|
116 |
+
}
|
117 |
+
if ( isset( $bg_image ) && '' != $bg_image ) {
|
118 |
+
$styles[$element]['background-image'] = 'url("' . $bg_image . '")';
|
119 |
+
if ( isset( $bg_repeat ) ) {
|
120 |
+
$styles[$element]['background-repeat'] = $bg_repeat;
|
121 |
+
}
|
122 |
+
if ( isset( $bg_size ) ) {
|
123 |
+
$styles[$element]['background-size'] = $bg_size;
|
124 |
+
}
|
125 |
+
if ( isset( $bg_attach ) ) {
|
126 |
+
$styles[$element]['background-attachment'] = $bg_attach;
|
127 |
+
}
|
128 |
+
if ( isset( $bg_position ) ) {
|
129 |
+
$styles[$element]['background-position'] = str_replace( '-', ' ', $bg_position );
|
130 |
+
}
|
131 |
}
|
132 |
|
133 |
}
|
includes/controls/class-kirki-customize-checkbox-control.php
DELETED
@@ -1,34 +0,0 @@
|
|
1 |
-
<?php
|
2 |
-
|
3 |
-
class Kirki_Customize_Checkbox_Control extends Kirki_Customize_Control {
|
4 |
-
|
5 |
-
public function __construct( $manager, $id, $args = array() ) {
|
6 |
-
$this->type = 'checkbox';
|
7 |
-
$this->mode = ( ! isset( $this->mode ) || empty( $this->mode ) ) ? 'checkbox' : $this->mode;
|
8 |
-
parent::__construct( $manager, $id, $args );
|
9 |
-
}
|
10 |
-
|
11 |
-
public function render_content() { ?>
|
12 |
-
<?php $display = ( 'switch' == $this->mode || 'toggle' == $this->mode ) ? ' style="display: none;"' : ''; ?>
|
13 |
-
<label class="customizer-checkbox">
|
14 |
-
<?php if ( 'switch' == $this->mode || 'toggle' == $this->mode ) : ?><div class="switch-info"><?php endif; ?>
|
15 |
-
<input type="checkbox" value="<?php echo esc_attr( $this->value() ); ?>" id="<?php echo $this->id . esc_attr( $this->value() ); ?>" <?php $this->link(); checked( $this->value() ); ?><?php echo $display; ?> />
|
16 |
-
<?php if ( 'switch' == $this->mode || 'toggle' == $this->mode ) : ?></div><?php endif; ?>
|
17 |
-
<strong><?php echo esc_html( $this->label ); ?></strong>
|
18 |
-
<?php if ( 'switch' == $this->mode || 'toggle' == $this->mode ) : ?>
|
19 |
-
<?php $classes = ( esc_attr( $this->value() ) ) ? ' On' : ' Off'; ?>
|
20 |
-
<?php $classes .= 'toggle' == $this->mode ? ' Round' : ''; ?>
|
21 |
-
<div class="Switch <?php echo $classes; ?>">
|
22 |
-
<div class="Toggle"></div>
|
23 |
-
<?php if ( 'toggle' != $this->mode ) : ?>
|
24 |
-
<span class="On"><?php _e( 'ON', 'kirki' ); ?></span>
|
25 |
-
<span class="Off"><?php _e( 'OFF', 'kirki' ); ?></span>
|
26 |
-
<?php endif; ?>
|
27 |
-
</div>
|
28 |
-
<?php endif; ?>
|
29 |
-
<?php $this->description(); ?>
|
30 |
-
<?php $this->subtitle(); ?>
|
31 |
-
</label>
|
32 |
-
<?php
|
33 |
-
}
|
34 |
-
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
includes/controls/class-kirki-customize-color-control.php
DELETED
@@ -1,83 +0,0 @@
|
|
1 |
-
<?php
|
2 |
-
|
3 |
-
/**
|
4 |
-
* Customize Color Control Class
|
5 |
-
*
|
6 |
-
* @package WordPress
|
7 |
-
* @subpackage Customize
|
8 |
-
* @since 3.4.0
|
9 |
-
*/
|
10 |
-
class Kirki_Customize_Color_Control extends Kirki_Customize_Control {
|
11 |
-
public $statuses;
|
12 |
-
|
13 |
-
/**
|
14 |
-
* Constructor.
|
15 |
-
*
|
16 |
-
* @since 3.4.0
|
17 |
-
* @uses WP_Customize_Control::__construct()
|
18 |
-
*
|
19 |
-
* @param WP_Customize_Manager $manager
|
20 |
-
* @param string $id
|
21 |
-
* @param array $args
|
22 |
-
*/
|
23 |
-
public function __construct( $manager, $id, $args = array() ) {
|
24 |
-
$this->type = 'color';
|
25 |
-
$this->statuses = array( '' => __( 'Default', 'kirki' ) );
|
26 |
-
parent::__construct( $manager, $id, $args );
|
27 |
-
}
|
28 |
-
|
29 |
-
/**
|
30 |
-
* Enqueue scripts/styles for the color picker.
|
31 |
-
*
|
32 |
-
* @since 3.4.0
|
33 |
-
*/
|
34 |
-
public function enqueue() {
|
35 |
-
wp_enqueue_script( 'wp-color-picker' );
|
36 |
-
wp_enqueue_style( 'wp-color-picker' );
|
37 |
-
}
|
38 |
-
|
39 |
-
/**
|
40 |
-
* Refresh the parameters passed to the JavaScript via JSON.
|
41 |
-
*
|
42 |
-
* @since 3.4.0
|
43 |
-
* @uses WP_Customize_Control::to_json()
|
44 |
-
*/
|
45 |
-
public function to_json() {
|
46 |
-
parent::to_json();
|
47 |
-
$this->json['statuses'] = $this->statuses;
|
48 |
-
}
|
49 |
-
|
50 |
-
/**
|
51 |
-
* Render the control's content.
|
52 |
-
*
|
53 |
-
* @since 3.4.0
|
54 |
-
*/
|
55 |
-
public function render_content() {
|
56 |
-
$this_default = $this->setting->default;
|
57 |
-
$default_attr = '';
|
58 |
-
$this_id = $this->id;
|
59 |
-
|
60 |
-
if ( $this_default ) {
|
61 |
-
if ( false === strpos( $this_default, '#' ) )
|
62 |
-
$this_default = '#' . $this_default;
|
63 |
-
$default_attr = ' data-default-color="' . esc_attr( $this_default ) . '"';
|
64 |
-
}
|
65 |
-
|
66 |
-
$setting_attr = ' data-customize-setting-link="' . esc_attr( $this_id ) . '"';
|
67 |
-
|
68 |
-
// The input's value gets set by JS. Don't fill it.
|
69 |
-
?>
|
70 |
-
<label>
|
71 |
-
<span class="customize-control-title">
|
72 |
-
<?php echo esc_html( $this->label ); ?>
|
73 |
-
<?php $this->description(); ?>
|
74 |
-
</span>
|
75 |
-
<?php $this->subtitle(); ?>
|
76 |
-
<div class="customize-control-content">
|
77 |
-
<input class="color-picker-hex kirki-color-picker" type="text" maxlength="7" placeholder="<?php esc_attr_e( 'Hex Value' ); ?>"<?php echo $default_attr; ?> <?php echo $setting_attr; ?>/>
|
78 |
-
</div>
|
79 |
-
</label>
|
80 |
-
<?php
|
81 |
-
|
82 |
-
}
|
83 |
-
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
includes/controls/class-kirki-customize-group-title-control.php
CHANGED
@@ -1,20 +1,18 @@
|
|
1 |
<?php
|
2 |
|
3 |
-
class Kirki_Customize_Group_Title_Control extends
|
4 |
|
5 |
-
public
|
6 |
-
$this->type = 'group_title';
|
7 |
-
parent::__construct( $manager, $id, $args );
|
8 |
-
}
|
9 |
|
10 |
public function render_content() { ?>
|
11 |
|
12 |
<label class="customizer-separator">
|
13 |
<span class="customize-control-title">
|
14 |
<?php echo esc_html( $this->label ); ?>
|
15 |
-
<?php $this->description
|
|
|
|
|
16 |
</span>
|
17 |
-
<?php $this->subtitle(); ?>
|
18 |
</label>
|
19 |
<?php
|
20 |
}
|
1 |
<?php
|
2 |
|
3 |
+
class Kirki_Customize_Group_Title_Control extends WP_Customize_Control {
|
4 |
|
5 |
+
public $type = 'group_title';
|
|
|
|
|
|
|
6 |
|
7 |
public function render_content() { ?>
|
8 |
|
9 |
<label class="customizer-separator">
|
10 |
<span class="customize-control-title">
|
11 |
<?php echo esc_html( $this->label ); ?>
|
12 |
+
<?php if ( ! empty( $this->description ) ) : ?>
|
13 |
+
<span class="description customize-control-description"><?php echo $this->description; ?></span>
|
14 |
+
<?php endif; ?>
|
15 |
</span>
|
|
|
16 |
</label>
|
17 |
<?php
|
18 |
}
|
includes/controls/class-kirki-customize-image-control.php
DELETED
@@ -1,193 +0,0 @@
|
|
1 |
-
<?php
|
2 |
-
|
3 |
-
/**
|
4 |
-
* Customize Image Control Class
|
5 |
-
*
|
6 |
-
* @package WordPress
|
7 |
-
* @subpackage Customize
|
8 |
-
* @since 3.4.0
|
9 |
-
*/
|
10 |
-
class Kirki_Customize_Image_Control extends WP_Customize_Upload_Control {
|
11 |
-
public $type = 'image';
|
12 |
-
public $get_url;
|
13 |
-
public $statuses;
|
14 |
-
public $extensions = array( 'jpg', 'jpeg', 'gif', 'png' );
|
15 |
-
public $description = '';
|
16 |
-
public $subtitle = '';
|
17 |
-
|
18 |
-
protected $tabs = array();
|
19 |
-
|
20 |
-
/**
|
21 |
-
* Constructor.
|
22 |
-
*
|
23 |
-
* @since 3.4.0
|
24 |
-
* @uses WP_Customize_Upload_Control::__construct()
|
25 |
-
*
|
26 |
-
* @param WP_Customize_Manager $manager
|
27 |
-
* @param string $id
|
28 |
-
* @param array $args
|
29 |
-
*/
|
30 |
-
public function __construct( $manager, $id, $args ) {
|
31 |
-
$this->statuses = array( '' => __( 'No Image', 'kirki' ) );
|
32 |
-
|
33 |
-
parent::__construct( $manager, $id, $args );
|
34 |
-
|
35 |
-
$this->add_tab( 'upload-new', __( 'Upload New', 'kirki' ), array( $this, 'tab_upload_new' ) );
|
36 |
-
$this->add_tab( 'uploaded', __( 'Uploaded', 'kirki' ), array( $this, 'tab_uploaded' ) );
|
37 |
-
|
38 |
-
// Early priority to occur before $this->manager->prepare_controls();
|
39 |
-
add_action( 'customize_controls_init', array( $this, 'prepare_control' ), 5 );
|
40 |
-
}
|
41 |
-
|
42 |
-
/**
|
43 |
-
* Prepares the control.
|
44 |
-
*
|
45 |
-
* If no tabs exist, removes the control from the manager.
|
46 |
-
*
|
47 |
-
* @since 3.4.2
|
48 |
-
*/
|
49 |
-
public function prepare_control() {
|
50 |
-
if ( ! $this->tabs )
|
51 |
-
$this->manager->remove_control( $this->id );
|
52 |
-
}
|
53 |
-
|
54 |
-
/**
|
55 |
-
* Refresh the parameters passed to the JavaScript via JSON.
|
56 |
-
*
|
57 |
-
* @since 3.4.0
|
58 |
-
* @uses WP_Customize_Upload_Control::to_json()
|
59 |
-
*/
|
60 |
-
public function to_json() {
|
61 |
-
parent::to_json();
|
62 |
-
$this->json['statuses'] = $this->statuses;
|
63 |
-
}
|
64 |
-
|
65 |
-
/**
|
66 |
-
* Render the control's content.
|
67 |
-
*
|
68 |
-
* @since 3.4.0
|
69 |
-
*/
|
70 |
-
public function render_content() {
|
71 |
-
$src = $this->value();
|
72 |
-
if ( isset( $this->get_url ) )
|
73 |
-
$src = call_user_func( $this->get_url, $src );
|
74 |
-
|
75 |
-
?>
|
76 |
-
<div class="customize-image-picker">
|
77 |
-
<span class="customize-control-title">
|
78 |
-
<?php echo esc_html( $this->label ); ?>
|
79 |
-
<?php if ( isset( $this->description ) && '' != $this->description ) { ?>
|
80 |
-
<a href="#" class="button tooltip hint--left" data-hint="<?php echo strip_tags( esc_html( $this->description ) ); ?>">?</a>
|
81 |
-
<?php } ?>
|
82 |
-
</span>
|
83 |
-
|
84 |
-
<?php if ( '' != $this->subtitle ) : ?>
|
85 |
-
<div class="customizer-subtitle"><?php echo $this->subtitle; ?></div>
|
86 |
-
<?php endif; ?>
|
87 |
-
|
88 |
-
<div class="customize-control-content">
|
89 |
-
<div class="dropdown preview-thumbnail" tabindex="0">
|
90 |
-
<div class="dropdown-content">
|
91 |
-
<?php if ( empty( $src ) ): ?>
|
92 |
-
<img style="display:none;" />
|
93 |
-
<?php else: ?>
|
94 |
-
<img src="<?php echo esc_url( set_url_scheme( $src ) ); ?>" />
|
95 |
-
<?php endif; ?>
|
96 |
-
<div class="dropdown-status"></div>
|
97 |
-
</div>
|
98 |
-
<div class="dropdown-arrow"></div>
|
99 |
-
</div>
|
100 |
-
</div>
|
101 |
-
|
102 |
-
<div class="library">
|
103 |
-
<ul>
|
104 |
-
<?php foreach ( $this->tabs as $id => $tab ): ?>
|
105 |
-
<li data-customize-tab='<?php echo esc_attr( $id ); ?>' tabindex='0'>
|
106 |
-
<?php echo esc_html( $tab['label'] ); ?>
|
107 |
-
</li>
|
108 |
-
<?php endforeach; ?>
|
109 |
-
</ul>
|
110 |
-
<?php foreach ( $this->tabs as $id => $tab ): ?>
|
111 |
-
<div class="library-content" data-customize-tab='<?php echo esc_attr( $id ); ?>'>
|
112 |
-
<?php call_user_func( $tab['callback'] ); ?>
|
113 |
-
</div>
|
114 |
-
<?php endforeach; ?>
|
115 |
-
</div>
|
116 |
-
|
117 |
-
<div class="actions">
|
118 |
-
<a href="#" class="remove"><?php _e( 'Remove Image', 'kirki' ); ?></a>
|
119 |
-
</div>
|
120 |
-
</div>
|
121 |
-
<?php
|
122 |
-
}
|
123 |
-
|
124 |
-
/**
|
125 |
-
* Add a tab to the control.
|
126 |
-
*
|
127 |
-
* @since 3.4.0
|
128 |
-
*
|
129 |
-
* @param string $id
|
130 |
-
* @param string $label
|
131 |
-
* @param mixed $callback
|
132 |
-
*/
|
133 |
-
public function add_tab( $id, $label, $callback ) {
|
134 |
-
$this->tabs[ $id ] = array(
|
135 |
-
'label' => $label,
|
136 |
-
'callback' => $callback,
|
137 |
-
);
|
138 |
-
}
|
139 |
-
|
140 |
-
/**
|
141 |
-
* Remove a tab from the control.
|
142 |
-
*
|
143 |
-
* @since 3.4.0
|
144 |
-
*
|
145 |
-
* @param string $id
|
146 |
-
*/
|
147 |
-
public function remove_tab( $id ) {
|
148 |
-
unset( $this->tabs[ $id ] );
|
149 |
-
}
|
150 |
-
|
151 |
-
/**
|
152 |
-
* @since 3.4.0
|
153 |
-
*/
|
154 |
-
public function tab_upload_new() {
|
155 |
-
if ( ! _device_can_upload() ) {
|
156 |
-
echo '<p>' . sprintf( __('The web browser on your device cannot be used to upload files. You may be able to use the <a href="%s">native app for your device</a> instead.'), 'https://wordpress.org/mobile/' ) . '</p>';
|
157 |
-
} else {
|
158 |
-
?>
|
159 |
-
<div class="upload-dropzone">
|
160 |
-
<?php _e('Drop a file here or <a href="#" class="upload">select a file</a>.'); ?>
|
161 |
-
</div>
|
162 |
-
<div class="upload-fallback">
|
163 |
-
<span class="button-secondary"><?php _e( 'Select File', 'kirki' ); ?></span>
|
164 |
-
</div>
|
165 |
-
<?php
|
166 |
-
}
|
167 |
-
}
|
168 |
-
|
169 |
-
/**
|
170 |
-
* @since 3.4.0
|
171 |
-
*/
|
172 |
-
public function tab_uploaded() {
|
173 |
-
?>
|
174 |
-
<div class="uploaded-target"></div>
|
175 |
-
<?php
|
176 |
-
}
|
177 |
-
|
178 |
-
/**
|
179 |
-
* @since 3.4.0
|
180 |
-
*
|
181 |
-
* @param string $url
|
182 |
-
* @param string $thumbnail_url
|
183 |
-
*/
|
184 |
-
public function print_tab_image( $url, $thumbnail_url = null ) {
|
185 |
-
$url = set_url_scheme( $url );
|
186 |
-
$thumbnail_url = ( $thumbnail_url ) ? set_url_scheme( $thumbnail_url ) : $url;
|
187 |
-
?>
|
188 |
-
<a href="#" class="thumbnail" data-customize-image-value="<?php echo esc_url( $url ); ?>">
|
189 |
-
<img src="<?php echo esc_url( $thumbnail_url ); ?>" />
|
190 |
-
</a>
|
191 |
-
<?php
|
192 |
-
}
|
193 |
-
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
includes/controls/class-kirki-customize-multicheck-control.php
CHANGED
@@ -5,14 +5,11 @@
|
|
5 |
* See https://github.com/gambitph/Titan-Framework/blob/v1.4.2/class-option-multicheck.php for more details.
|
6 |
*/
|
7 |
|
8 |
-
class Kirki_Customize_Multicheck_Control extends
|
9 |
|
10 |
-
|
11 |
|
12 |
-
|
13 |
-
$this->type = 'multicheck';
|
14 |
-
parent::__construct( $manager, $id, $args );
|
15 |
-
}
|
16 |
|
17 |
// Since theme_mod cannot handle multichecks, we will do it with some JS
|
18 |
public function render_content() {
|
@@ -57,9 +54,10 @@ class Kirki_Customize_Multicheck_Control extends Kirki_Customize_Control {
|
|
57 |
<label class='tf-multicheck-container'>
|
58 |
<span class="customize-control-title">
|
59 |
<?php echo esc_html( $this->label ); ?>
|
60 |
-
<?php $this->description
|
|
|
|
|
61 |
</span>
|
62 |
-
<?php $this->subtitle(); ?>
|
63 |
<?php
|
64 |
foreach ( $this->choices as $value => $label ) {
|
65 |
printf('<label for="%s"><input class="tf-multicheck" id="%s" type="checkbox" value="%s" %s/> %s</label><br>',
|
5 |
* See https://github.com/gambitph/Titan-Framework/blob/v1.4.2/class-option-multicheck.php for more details.
|
6 |
*/
|
7 |
|
8 |
+
class Kirki_Customize_Multicheck_Control extends WP_Customize_Control {
|
9 |
|
10 |
+
public $type = 'multicheck';
|
11 |
|
12 |
+
private static $firstLoad = true;
|
|
|
|
|
|
|
13 |
|
14 |
// Since theme_mod cannot handle multichecks, we will do it with some JS
|
15 |
public function render_content() {
|
54 |
<label class='tf-multicheck-container'>
|
55 |
<span class="customize-control-title">
|
56 |
<?php echo esc_html( $this->label ); ?>
|
57 |
+
<?php if ( ! empty( $this->description ) ) : ?>
|
58 |
+
<span class="description customize-control-description"><?php echo $this->description; ?></span>
|
59 |
+
<?php endif; ?>
|
60 |
</span>
|
|
|
61 |
<?php
|
62 |
foreach ( $this->choices as $value => $label ) {
|
63 |
printf('<label for="%s"><input class="tf-multicheck" id="%s" type="checkbox" value="%s" %s/> %s</label><br>',
|
includes/controls/class-kirki-customize-number-control.php
CHANGED
@@ -1,20 +1,18 @@
|
|
1 |
<?php
|
2 |
|
3 |
-
class Kirki_Customize_Number_Control extends
|
4 |
|
5 |
-
public
|
6 |
-
$this->type = 'number';
|
7 |
-
parent::__construct( $manager, $id, $args );
|
8 |
-
}
|
9 |
|
10 |
public function render_content() { ?>
|
11 |
|
12 |
<label class="customizer-text">
|
13 |
<span class="customize-control-title">
|
14 |
<?php echo esc_html( $this->label ); ?>
|
15 |
-
<?php $this->description
|
|
|
|
|
16 |
</span>
|
17 |
-
<?php $this->subtitle(); ?>
|
18 |
<input type="number" <?php $this->link(); ?> value="<?php echo intval( $this->value() ); ?>"/>
|
19 |
<?php if ( isset( $this->description ) && '' != $this->description ) { ?>
|
20 |
<a href="#" class="button tooltip hint--left" data-hint="<?php echo strip_tags( esc_html( $this->description ) ); ?>">?</a>
|
1 |
<?php
|
2 |
|
3 |
+
class Kirki_Customize_Number_Control extends WP_Customize_Control {
|
4 |
|
5 |
+
public $type = 'number';
|
|
|
|
|
|
|
6 |
|
7 |
public function render_content() { ?>
|
8 |
|
9 |
<label class="customizer-text">
|
10 |
<span class="customize-control-title">
|
11 |
<?php echo esc_html( $this->label ); ?>
|
12 |
+
<?php if ( ! empty( $this->description ) ) : ?>
|
13 |
+
<span class="description customize-control-description"><?php echo $this->description; ?></span>
|
14 |
+
<?php endif; ?>
|
15 |
</span>
|
|
|
16 |
<input type="number" <?php $this->link(); ?> value="<?php echo intval( $this->value() ); ?>"/>
|
17 |
<?php if ( isset( $this->description ) && '' != $this->description ) { ?>
|
18 |
<a href="#" class="button tooltip hint--left" data-hint="<?php echo strip_tags( esc_html( $this->description ) ); ?>">?</a>
|
includes/controls/class-kirki-customize-radio-buttonset-control.php
ADDED
@@ -0,0 +1,40 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
|
3 |
+
class Kirki_Customize_Radio_Buttonset_Control extends WP_Customize_Control {
|
4 |
+
|
5 |
+
public $type = 'radio-buttonset';
|
6 |
+
|
7 |
+
public function enqueue() {
|
8 |
+
wp_enqueue_script( 'jquery-ui-button' );
|
9 |
+
}
|
10 |
+
|
11 |
+
public function render_content() {
|
12 |
+
|
13 |
+
if ( empty( $this->choices ) ) {
|
14 |
+
return;
|
15 |
+
}
|
16 |
+
|
17 |
+
$name = '_customize-radio-' . $this->id;
|
18 |
+
|
19 |
+
?>
|
20 |
+
<span class="customize-control-title">
|
21 |
+
<?php echo esc_html( $this->label ); ?>
|
22 |
+
<?php if ( ! empty( $this->description ) ) : ?>
|
23 |
+
<span class="description customize-control-description"><?php echo $this->description; ?></span>
|
24 |
+
<?php endif; ?>
|
25 |
+
</span>
|
26 |
+
|
27 |
+
<div id="input_<?php echo $this->id; ?>" class="<?php echo $this->mode; ?>">
|
28 |
+
<?php foreach ( $this->choices as $value => $label ) : ?>
|
29 |
+
<input type="radio" value="<?php echo esc_attr( $value ); ?>" name="<?php echo esc_attr( $name ); ?>" id="<?php echo $this->id . $value; ?>" <?php $this->link(); checked( $this->value(), $value ); ?>>
|
30 |
+
<label for="<?php echo $this->id . $value; ?>">
|
31 |
+
<?php echo esc_html( $label ); ?>
|
32 |
+
</label>
|
33 |
+
</input>
|
34 |
+
<?php endforeach; ?>
|
35 |
+
</div>
|
36 |
+
<script>jQuery(document).ready(function($) { $( '[id="input_<?php echo $this->id; ?>"]' ).buttonset(); });</script>
|
37 |
+
<?php
|
38 |
+
}
|
39 |
+
|
40 |
+
}
|
includes/controls/class-kirki-customize-radio-control.php
DELETED
@@ -1,85 +0,0 @@
|
|
1 |
-
<?php
|
2 |
-
|
3 |
-
class Kirki_Customize_Radio_Control extends Kirki_Customize_Control {
|
4 |
-
|
5 |
-
public function __construct( $manager, $id, $args = array() ) {
|
6 |
-
$this->type = 'radio';
|
7 |
-
$this->mode = ( ! isset( $this->mode ) || empty( $this->mode ) ) ? 'radio' : $this->mode;
|
8 |
-
parent::__construct( $manager, $id, $args );
|
9 |
-
}
|
10 |
-
|
11 |
-
public function enqueue() {
|
12 |
-
|
13 |
-
if ( 'buttonset' == $this->mode || 'image' == $this->mode ) {
|
14 |
-
wp_enqueue_script( 'jquery-ui-button' );
|
15 |
-
}
|
16 |
-
|
17 |
-
}
|
18 |
-
|
19 |
-
public function render_content() {
|
20 |
-
|
21 |
-
if ( empty( $this->choices ) ) {
|
22 |
-
return;
|
23 |
-
}
|
24 |
-
|
25 |
-
$name = '_customize-radio-' . $this->id;
|
26 |
-
|
27 |
-
?>
|
28 |
-
<span class="customize-control-title">
|
29 |
-
<?php echo esc_html( $this->label ); ?>
|
30 |
-
<?php $this->description(); ?>
|
31 |
-
</span>
|
32 |
-
<?php $this->subtitle(); ?>
|
33 |
-
|
34 |
-
<div id="input_<?php echo $this->id; ?>" class="<?php echo $this->mode; ?>">
|
35 |
-
<?php
|
36 |
-
|
37 |
-
// JqueryUI Button Sets
|
38 |
-
if ( 'buttonset' == $this->mode ) {
|
39 |
-
|
40 |
-
foreach ( $this->choices as $value => $label ) : ?>
|
41 |
-
<input type="radio" value="<?php echo esc_attr( $value ); ?>" name="<?php echo esc_attr( $name ); ?>" id="<?php echo $this->id . $value; ?>" <?php $this->link(); checked( $this->value(), $value ); ?>>
|
42 |
-
<label for="<?php echo $this->id . $value; ?>">
|
43 |
-
<?php echo esc_html( $label ); ?>
|
44 |
-
</label>
|
45 |
-
</input>
|
46 |
-
<?php
|
47 |
-
endforeach;
|
48 |
-
|
49 |
-
// Image radios.
|
50 |
-
} elseif ( 'image' == $this->mode ) {
|
51 |
-
|
52 |
-
foreach ( $this->choices as $value => $label ) : ?>
|
53 |
-
<input class="image-select" type="radio" value="<?php echo esc_attr( $value ); ?>" name="<?php echo esc_attr( $name ); ?>" id="<?php echo $this->id . $value; ?>" <?php $this->link(); checked( $this->value(), $value ); ?>>
|
54 |
-
<label for="<?php echo $this->id . $value; ?>">
|
55 |
-
<img src="<?php echo esc_html( $label ); ?>">
|
56 |
-
</label>
|
57 |
-
</input>
|
58 |
-
<?php
|
59 |
-
endforeach;
|
60 |
-
|
61 |
-
// Normal radios
|
62 |
-
} else {
|
63 |
-
|
64 |
-
foreach ( $this->choices as $value => $label ) :
|
65 |
-
?>
|
66 |
-
<label class="customizer-radio">
|
67 |
-
<input class="kirki-radio" type="radio" value="<?php echo esc_attr( $value ); ?>" name="<?php echo esc_attr( $name ); ?>" <?php $this->link(); checked( $this->value(), $value ); ?> />
|
68 |
-
<?php echo esc_html( $label ); ?><br/>
|
69 |
-
</label>
|
70 |
-
<?php
|
71 |
-
endforeach;
|
72 |
-
|
73 |
-
}
|
74 |
-
?>
|
75 |
-
</div>
|
76 |
-
<?php if ( 'buttonset' == $this->mode || 'image' == $this->mode ) { ?>
|
77 |
-
<script>
|
78 |
-
jQuery(document).ready(function($) {
|
79 |
-
$( '[id="input_<?php echo $this->id; ?>"]' ).buttonset();
|
80 |
-
});
|
81 |
-
</script>
|
82 |
-
<?php }
|
83 |
-
|
84 |
-
}
|
85 |
-
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
includes/controls/class-kirki-customize-radio-image-control.php
ADDED
@@ -0,0 +1,40 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
|
3 |
+
class Kirki_Customize_Radio_Image_Control extends WP_Customize_Control {
|
4 |
+
|
5 |
+
public $type = 'radio-image';
|
6 |
+
|
7 |
+
public function enqueue() {
|
8 |
+
wp_enqueue_script( 'jquery-ui-button' );
|
9 |
+
}
|
10 |
+
|
11 |
+
public function render_content() {
|
12 |
+
|
13 |
+
if ( empty( $this->choices ) ) {
|
14 |
+
return;
|
15 |
+
}
|
16 |
+
|
17 |
+
$name = '_customize-radio-' . $this->id;
|
18 |
+
|
19 |
+
?>
|
20 |
+
<span class="customize-control-title">
|
21 |
+
<?php echo esc_html( $this->label ); ?>
|
22 |
+
<?php if ( ! empty( $this->description ) ) : ?>
|
23 |
+
<span class="description customize-control-description"><?php echo $this->description; ?></span>
|
24 |
+
<?php endif; ?>
|
25 |
+
</span>
|
26 |
+
|
27 |
+
<div id="input_<?php echo $this->id; ?>" class="image">
|
28 |
+
<?php foreach ( $this->choices as $value => $label ) : ?>
|
29 |
+
<input class="image-select" type="radio" value="<?php echo esc_attr( $value ); ?>" name="<?php echo esc_attr( $name ); ?>" id="<?php echo $this->id . $value; ?>" <?php $this->link(); checked( $this->value(), $value ); ?>>
|
30 |
+
<label for="<?php echo $this->id . $value; ?>">
|
31 |
+
<img src="<?php echo esc_html( $label ); ?>">
|
32 |
+
</label>
|
33 |
+
</input>
|
34 |
+
<?php endforeach; ?>
|
35 |
+
</div>
|
36 |
+
<script>jQuery(document).ready(function($) { $( '[id="input_<?php echo $this->id; ?>"]' ).buttonset(); });</script>
|
37 |
+
<?php
|
38 |
+
}
|
39 |
+
|
40 |
+
}
|
includes/controls/class-kirki-customize-select-control.php
DELETED
@@ -1,32 +0,0 @@
|
|
1 |
-
<?php
|
2 |
-
|
3 |
-
class Kirki_Customize_Select_Control extends Kirki_Customize_Control {
|
4 |
-
|
5 |
-
public function __construct( $manager, $id, $args = array() ) {
|
6 |
-
$this->type = 'select';
|
7 |
-
parent::__construct( $manager, $id, $args );
|
8 |
-
}
|
9 |
-
|
10 |
-
public function render_content() {
|
11 |
-
|
12 |
-
if ( empty( $this->choices ) ) {
|
13 |
-
return;
|
14 |
-
} ?>
|
15 |
-
|
16 |
-
<label>
|
17 |
-
<span class="customize-control-title">
|
18 |
-
<?php echo esc_html( $this->label ); ?>
|
19 |
-
<?php $this->description(); ?>
|
20 |
-
</span>
|
21 |
-
<?php $this->subtitle(); ?>
|
22 |
-
<select <?php $this->link(); ?>>
|
23 |
-
<?php
|
24 |
-
foreach ( $this->choices as $value => $label ) {
|
25 |
-
echo '<option value="' . esc_attr( $value ) . '"' . selected( $this->value(), $value, false ) . '>' . $label . '</option>';
|
26 |
-
} ?>
|
27 |
-
</select>
|
28 |
-
</label>
|
29 |
-
<?php
|
30 |
-
|
31 |
-
}
|
32 |
-
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
includes/controls/class-kirki-customize-slider-control.php
CHANGED
@@ -1,16 +1,12 @@
|
|
1 |
<?php
|
2 |
|
3 |
-
class Kirki_Customize_Slider_Control extends
|
4 |
|
5 |
-
public
|
6 |
-
$this->type = 'slider';
|
7 |
-
parent::__construct( $manager, $id, $args );
|
8 |
-
}
|
9 |
|
10 |
public function enqueue() {
|
11 |
-
|
12 |
wp_enqueue_script( 'jquery-ui-slider' );
|
13 |
-
|
14 |
}
|
15 |
|
16 |
public function render_content() { ?>
|
@@ -18,9 +14,10 @@ class Kirki_Customize_Slider_Control extends Kirki_Customize_Control {
|
|
18 |
|
19 |
<span class="customize-control-title">
|
20 |
<?php echo esc_html( $this->label ); ?>
|
21 |
-
<?php $this->description
|
|
|
|
|
22 |
</span>
|
23 |
-
<?php $this->subtitle(); ?>
|
24 |
|
25 |
<input type="text" class="kirki-slider" id="input_<?php echo $this->id; ?>" disabled value="<?php echo $this->value(); ?>" <?php $this->link(); ?>/>
|
26 |
|
1 |
<?php
|
2 |
|
3 |
+
class Kirki_Customize_Slider_Control extends WP_Customize_Control {
|
4 |
|
5 |
+
public $type = 'slider';
|
|
|
|
|
|
|
6 |
|
7 |
public function enqueue() {
|
8 |
+
wp_enqueue_script( 'jquery-ui' );
|
9 |
wp_enqueue_script( 'jquery-ui-slider' );
|
|
|
10 |
}
|
11 |
|
12 |
public function render_content() { ?>
|
14 |
|
15 |
<span class="customize-control-title">
|
16 |
<?php echo esc_html( $this->label ); ?>
|
17 |
+
<?php if ( ! empty( $this->description ) ) : ?>
|
18 |
+
<span class="description customize-control-description"><?php echo $this->description; ?></span>
|
19 |
+
<?php endif; ?>
|
20 |
</span>
|
|
|
21 |
|
22 |
<input type="text" class="kirki-slider" id="input_<?php echo $this->id; ?>" disabled value="<?php echo $this->value(); ?>" <?php $this->link(); ?>/>
|
23 |
|
includes/controls/class-kirki-customize-sortable-control.php
CHANGED
@@ -1,11 +1,8 @@
|
|
1 |
<?php
|
2 |
|
3 |
-
class Kirki_Customize_Sortable_Control extends
|
4 |
|
5 |
-
public
|
6 |
-
$this->type = 'sortable';
|
7 |
-
parent::__construct( $manager, $id, $args );
|
8 |
-
}
|
9 |
|
10 |
public function enqueue() {
|
11 |
wp_enqueue_script( 'jquery-ui-core' );
|
@@ -27,9 +24,10 @@ class Kirki_Customize_Sortable_Control extends Kirki_Customize_Control {
|
|
27 |
<label class='kirki-sortable'>
|
28 |
<span class="customize-control-title">
|
29 |
<?php echo esc_html( $this->label ); ?>
|
30 |
-
<?php $this->description
|
|
|
|
|
31 |
</span>
|
32 |
-
<?php $this->subtitle(); ?>
|
33 |
|
34 |
<?php
|
35 |
$values = $this->value();
|
@@ -39,11 +37,11 @@ class Kirki_Customize_Sortable_Control extends Kirki_Customize_Control {
|
|
39 |
$visibleButton = '<i class="dashicons dashicons-visibility visibility"></i>';
|
40 |
?>
|
41 |
<ul>
|
42 |
-
<?php foreach ( $values as $
|
43 |
<?php printf( "<li class='kirki-sortable-item' data-value='%s'><i class='dashicons dashicons-menu'></i>%s%s</li>", esc_attr( $value ), $visibleButton, $this->choices[$value] ); ?>
|
44 |
<?php endforeach; ?>
|
45 |
<?php $invisibleKeys = array_diff( array_keys( $this->choices ), $values ); ?>
|
46 |
-
<?php foreach ( $invisibleKeys as $
|
47 |
<?php printf( "<li class='kirki-sortable-item' data-value='%s'><i class='dashicons dashicons-menu'></i>%s%s</li>", esc_attr( $value ), $visibleButton, $this->choices[$value] ); ?>
|
48 |
<?php endforeach; ?>
|
49 |
</ul>
|
1 |
<?php
|
2 |
|
3 |
+
class Kirki_Customize_Sortable_Control extends WP_Customize_Control {
|
4 |
|
5 |
+
public $type = 'sortable';
|
|
|
|
|
|
|
6 |
|
7 |
public function enqueue() {
|
8 |
wp_enqueue_script( 'jquery-ui-core' );
|
24 |
<label class='kirki-sortable'>
|
25 |
<span class="customize-control-title">
|
26 |
<?php echo esc_html( $this->label ); ?>
|
27 |
+
<?php if ( ! empty( $this->description ) ) : ?>
|
28 |
+
<span class="description customize-control-description"><?php echo $this->description; ?></span>
|
29 |
+
<?php endif; ?>
|
30 |
</span>
|
|
|
31 |
|
32 |
<?php
|
33 |
$values = $this->value();
|
37 |
$visibleButton = '<i class="dashicons dashicons-visibility visibility"></i>';
|
38 |
?>
|
39 |
<ul>
|
40 |
+
<?php foreach ( $values as $key => $value ) : ?>
|
41 |
<?php printf( "<li class='kirki-sortable-item' data-value='%s'><i class='dashicons dashicons-menu'></i>%s%s</li>", esc_attr( $value ), $visibleButton, $this->choices[$value] ); ?>
|
42 |
<?php endforeach; ?>
|
43 |
<?php $invisibleKeys = array_diff( array_keys( $this->choices ), $values ); ?>
|
44 |
+
<?php foreach ( $invisibleKeys as $key => $value ) : ?>
|
45 |
<?php printf( "<li class='kirki-sortable-item' data-value='%s'><i class='dashicons dashicons-menu'></i>%s%s</li>", esc_attr( $value ), $visibleButton, $this->choices[$value] ); ?>
|
46 |
<?php endforeach; ?>
|
47 |
</ul>
|
includes/controls/class-kirki-customize-switch-control.php
ADDED
@@ -0,0 +1,28 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
|
3 |
+
class Kirki_Customize_Switch_Control extends WP_Customize_Control {
|
4 |
+
|
5 |
+
public $type = 'switch';
|
6 |
+
|
7 |
+
/**
|
8 |
+
* Render the control's content.
|
9 |
+
*/
|
10 |
+
protected function render_content() { ?>
|
11 |
+
<label>
|
12 |
+
<div class="switch-info">
|
13 |
+
<input style="display: none;" type="checkbox" value="<?php echo esc_attr( $this->value() ); ?>" <?php $this->link(); checked( $this->value() ); ?> />
|
14 |
+
</div>
|
15 |
+
<?php echo esc_html( $this->label ); ?>
|
16 |
+
<?php if ( ! empty( $this->description ) ) : ?>
|
17 |
+
<span class="description customize-control-description"><?php echo $this->description; ?></span>
|
18 |
+
<?php endif; ?>
|
19 |
+
<?php $classes = ( esc_attr( $this->value() ) ) ? ' On' : ' Off'; ?>
|
20 |
+
<div class="Switch <?php echo $classes; ?>">
|
21 |
+
<div class="Toggle"></div>
|
22 |
+
<span class="On"><?php _e( 'ON', 'kirki' ); ?></span>
|
23 |
+
<span class="Off"><?php _e( 'OFF', 'kirki' ); ?></span>
|
24 |
+
</div>
|
25 |
+
</label>
|
26 |
+
<?php
|
27 |
+
}
|
28 |
+
}
|
includes/controls/class-kirki-customize-text-control.php
DELETED
@@ -1,24 +0,0 @@
|
|
1 |
-
<?php
|
2 |
-
|
3 |
-
class Kirki_Customize_Text_Control extends Kirki_Customize_Control {
|
4 |
-
|
5 |
-
public function __construct( $manager, $id, $args = array() ) {
|
6 |
-
$this->type = 'text';
|
7 |
-
parent::__construct( $manager, $id, $args );
|
8 |
-
}
|
9 |
-
|
10 |
-
public function render_content() { ?>
|
11 |
-
|
12 |
-
<label class="customizer-text">
|
13 |
-
<span class="customize-control-title">
|
14 |
-
<?php echo esc_html( $this->label ); ?>
|
15 |
-
<?php $this->description(); ?>
|
16 |
-
</span>
|
17 |
-
<?php $this->subtitle(); ?>
|
18 |
-
|
19 |
-
<input type="text" value="<?php echo esc_attr( $this->value() ); ?>" <?php $this->link(); ?> />
|
20 |
-
</label>
|
21 |
-
<?php
|
22 |
-
|
23 |
-
}
|
24 |
-
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
includes/controls/class-kirki-customize-textarea-control.php
DELETED
@@ -1,23 +0,0 @@
|
|
1 |
-
<?php
|
2 |
-
|
3 |
-
class Kirki_Customize_Textarea_Control extends Kirki_Customize_Control {
|
4 |
-
|
5 |
-
public function __construct( $manager, $id, $args = array() ) {
|
6 |
-
$this->type = 'textarea';
|
7 |
-
parent::__construct( $manager, $id, $args );
|
8 |
-
}
|
9 |
-
|
10 |
-
public function render_content() { ?>
|
11 |
-
<label class="customizer-textarea">
|
12 |
-
<span class="customize-control-title">
|
13 |
-
<?php echo esc_html( $this->label ); ?>
|
14 |
-
<?php $this->description(); ?>
|
15 |
-
</span>
|
16 |
-
<?php $this->subtitle(); ?>
|
17 |
-
|
18 |
-
<textarea class="of-input" rows="5" style="width:100%;" <?php $this->link(); ?>><?php echo esc_textarea( $this->value() ); ?></textarea>
|
19 |
-
</label>
|
20 |
-
<?php
|
21 |
-
|
22 |
-
}
|
23 |
-
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
includes/controls/class-kirki-customize-toggle-control.php
ADDED
@@ -0,0 +1,27 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
|
3 |
+
class Kirki_Customize_Toggle_Control extends WP_Customize_Control {
|
4 |
+
|
5 |
+
public $type = 'toggle';
|
6 |
+
|
7 |
+
/**
|
8 |
+
* Render the control's content.
|
9 |
+
*/
|
10 |
+
protected function render_content() { ?>
|
11 |
+
<label>
|
12 |
+
<div class="switch-info">
|
13 |
+
<input style="display: none;" type="checkbox" value="<?php echo esc_attr( $this->value() ); ?>" <?php $this->link(); checked( $this->value() ); ?> />
|
14 |
+
</div>
|
15 |
+
<?php echo esc_html( $this->label ); ?>
|
16 |
+
<?php if ( ! empty( $this->description ) ) : ?>
|
17 |
+
<span class="description customize-control-description"><?php echo $this->description; ?></span>
|
18 |
+
<?php endif; ?>
|
19 |
+
<?php $classes = ( esc_attr( $this->value() ) ) ? ' On' : ' Off'; ?>
|
20 |
+
<?php $classes .= ' Round'; ?>
|
21 |
+
<div class="Switch <?php echo $classes; ?>">
|
22 |
+
<div class="Toggle"></div>
|
23 |
+
</div>
|
24 |
+
</label>
|
25 |
+
<?php
|
26 |
+
}
|
27 |
+
}
|
includes/controls/class-kirki-customize-upload-control.php
DELETED
@@ -1,69 +0,0 @@
|
|
1 |
-
<?php
|
2 |
-
|
3 |
-
/**
|
4 |
-
* Customize Upload Control Class
|
5 |
-
*
|
6 |
-
* @package WordPress
|
7 |
-
* @subpackage Customize
|
8 |
-
* @since 3.4.0
|
9 |
-
*/
|
10 |
-
class Kirki_Customize_Upload_Control extends Kirki_Customize_Control {
|
11 |
-
public $removed = '';
|
12 |
-
public $context;
|
13 |
-
public $extensions = array();
|
14 |
-
|
15 |
-
public function __construct( $manager, $id, $args = array() ) {
|
16 |
-
$this->type = 'upload';
|
17 |
-
parent::__construct( $manager, $id, $args );
|
18 |
-
}
|
19 |
-
|
20 |
-
/**
|
21 |
-
* Enqueue control related scripts/styles.
|
22 |
-
*
|
23 |
-
* @since 3.4.0
|
24 |
-
*/
|
25 |
-
public function enqueue() {
|
26 |
-
wp_enqueue_script( 'wp-plupload' );
|
27 |
-
}
|
28 |
-
|
29 |
-
/**
|
30 |
-
* Refresh the parameters passed to the JavaScript via JSON.
|
31 |
-
*
|
32 |
-
* @since 3.4.0
|
33 |
-
* @uses WP_Customize_Control::to_json()
|
34 |
-
*/
|
35 |
-
public function to_json() {
|
36 |
-
parent::to_json();
|
37 |
-
|
38 |
-
$this->json['removed'] = $this->removed;
|
39 |
-
|
40 |
-
if ( $this->context )
|
41 |
-
$this->json['context'] = $this->context;
|
42 |
-
|
43 |
-
if ( $this->extensions )
|
44 |
-
$this->json['extensions'] = implode( ',', $this->extensions );
|
45 |
-
}
|
46 |
-
|
47 |
-
/**
|
48 |
-
* Render the control's content.
|
49 |
-
*
|
50 |
-
* @since 3.4.0
|
51 |
-
*/
|
52 |
-
public function render_content() {
|
53 |
-
?>
|
54 |
-
<label>
|
55 |
-
<span class="customize-control-title">
|
56 |
-
<?php echo esc_html( $this->label ); ?>
|
57 |
-
<?php $this->description(); ?>
|
58 |
-
</span>
|
59 |
-
<?php $this->subtitle(); ?>
|
60 |
-
|
61 |
-
<div>
|
62 |
-
<a href="#" class="button-secondary upload"><?php _e( 'Upload', 'kirki' ); ?></a>
|
63 |
-
<a href="#" class="remove"><?php _e( 'Remove', 'kirki' ); ?></a>
|
64 |
-
</div>
|
65 |
-
</label>
|
66 |
-
<?php
|
67 |
-
|
68 |
-
}
|
69 |
-
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
kirki.php
CHANGED
@@ -5,7 +5,7 @@ Plugin URI: http://kirki.org
|
|
5 |
Description: An options framework using and extending the WordPress Customizer
|
6 |
Author: Aristeides Stathopoulos
|
7 |
Author URI: http://press.codes
|
8 |
-
Version: 0.
|
9 |
*/
|
10 |
|
11 |
// Load Kirki_Fonts before everything else
|
@@ -16,10 +16,14 @@ include_once( dirname( __FILE__ ) . '/includes/class-kirki-fonts.php' );
|
|
16 |
*/
|
17 |
if ( ! class_exists( 'Kirki' ) ) :
|
18 |
class Kirki {
|
|
|
19 |
public $scripts;
|
20 |
public $styles;
|
|
|
|
|
|
|
21 |
|
22 |
-
function __construct() {
|
23 |
|
24 |
if ( ! defined( 'KIRKI_PATH' ) ) {
|
25 |
define( 'KIRKI_PATH', dirname( __FILE__ ) );
|
@@ -39,8 +43,9 @@ class Kirki {
|
|
39 |
include_once( dirname( __FILE__ ) . '/includes/class-kirki-controls.php' );
|
40 |
include_once( dirname( __FILE__ ) . '/includes/deprecated.php' );
|
41 |
|
42 |
-
$this->scripts
|
43 |
-
$this->styles
|
|
|
44 |
|
45 |
add_action( 'customize_register', array( $this, 'include_customizer_controls' ), 1 );
|
46 |
add_action( 'customize_register', array( $this, 'customizer_builder' ), 99 );
|
@@ -48,26 +53,41 @@ class Kirki {
|
|
48 |
|
49 |
}
|
50 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
51 |
/**
|
52 |
-
* Include the necessary files
|
|
|
53 |
*/
|
54 |
function include_customizer_controls() {
|
55 |
|
56 |
-
include_once( dirname( __FILE__ ) . '/includes/class-kirki-customize-control.php' );
|
57 |
-
|
58 |
$controls = $this->get_controls();
|
59 |
foreach ( $controls as $control ) {
|
60 |
-
if ( '
|
61 |
-
|
62 |
-
|
63 |
-
|
64 |
-
|
65 |
-
|
66 |
-
}
|
67 |
-
include_once( KIRKI_PATH . '/includes/controls/class-kirki-customize-
|
68 |
-
|
69 |
-
include_once( KIRKI_PATH . '/includes/controls/class-kirki-customize-
|
70 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
71 |
include_once( KIRKI_PATH . '/includes/controls/class-kirki-customize-slider-control.php' );
|
72 |
}
|
73 |
}
|
@@ -81,7 +101,7 @@ class Kirki {
|
|
81 |
|
82 |
$controls = $this->get_controls();
|
83 |
$kirki_settings = new Kirki_Settings();
|
84 |
-
$kirki_controls =
|
85 |
|
86 |
// Early exit if controls are not set or if they're empty
|
87 |
if ( ! isset( $controls ) || empty( $controls ) ) {
|
@@ -144,8 +164,54 @@ class Kirki {
|
|
144 |
}
|
145 |
|
146 |
}
|
|
|
147 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
148 |
global $kirki;
|
149 |
-
$kirki = new Kirki();
|
150 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
151 |
endif;
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
5 |
Description: An options framework using and extending the WordPress Customizer
|
6 |
Author: Aristeides Stathopoulos
|
7 |
Author URI: http://press.codes
|
8 |
+
Version: 0.7
|
9 |
*/
|
10 |
|
11 |
// Load Kirki_Fonts before everything else
|
16 |
*/
|
17 |
if ( ! class_exists( 'Kirki' ) ) :
|
18 |
class Kirki {
|
19 |
+
|
20 |
public $scripts;
|
21 |
public $styles;
|
22 |
+
public $controls;
|
23 |
+
|
24 |
+
private static $instance;
|
25 |
|
26 |
+
protected function __construct() {
|
27 |
|
28 |
if ( ! defined( 'KIRKI_PATH' ) ) {
|
29 |
define( 'KIRKI_PATH', dirname( __FILE__ ) );
|
43 |
include_once( dirname( __FILE__ ) . '/includes/class-kirki-controls.php' );
|
44 |
include_once( dirname( __FILE__ ) . '/includes/deprecated.php' );
|
45 |
|
46 |
+
$this->scripts = Kirki_Scripts::get_instance();
|
47 |
+
$this->styles = new Kirki_Style();
|
48 |
+
$this->controls = new Kirki_Controls();
|
49 |
|
50 |
add_action( 'customize_register', array( $this, 'include_customizer_controls' ), 1 );
|
51 |
add_action( 'customize_register', array( $this, 'customizer_builder' ), 99 );
|
53 |
|
54 |
}
|
55 |
|
56 |
+
public static function get_instance() {
|
57 |
+
if ( null == self::$instance ) {
|
58 |
+
self::$instance = new self;
|
59 |
+
}
|
60 |
+
|
61 |
+
return self::$instance;
|
62 |
+
}
|
63 |
+
|
64 |
/**
|
65 |
+
* Include the necessary files for custom controls.
|
66 |
+
* Default WP Controls are not included here because they are already being loaded from WP Core.
|
67 |
*/
|
68 |
function include_customizer_controls() {
|
69 |
|
|
|
|
|
70 |
$controls = $this->get_controls();
|
71 |
foreach ( $controls as $control ) {
|
72 |
+
if ( 'group_title' == $control['type'] ) {
|
73 |
+
include_once( KIRKI_PATH . '/includes/controls/class-kirki-customize-group-title-control.php' );
|
74 |
+
} elseif ( 'multicheck' == $control['type'] ) {
|
75 |
+
include_once( KIRKI_PATH . '/includes/controls/class-kirki-customize-multicheck-control.php' );
|
76 |
+
} elseif ( 'number' == $control['type'] ) {
|
77 |
+
include_once( KIRKI_PATH . '/includes/controls/class-kirki-customize-number-control.php' );
|
78 |
+
} elseif ( 'radio-buttonset' == $control['type'] || ( 'radio' == $control['type'] && isset( $control['mode'] ) && 'buttonset' == $control['mode'] ) ) {
|
79 |
+
include_once( KIRKI_PATH . '/includes/controls/class-kirki-customize-radio-buttonset-control.php' );
|
80 |
+
} elseif ( 'radio-image' == $control['type'] || ( 'radio' == $control['type'] && isset( $control['mode'] ) && 'image' == $control['mode'] ) ) {
|
81 |
+
include_once( KIRKI_PATH . '/includes/controls/class-kirki-customize-radio-image-control.php' );
|
82 |
+
} elseif ( 'slider' == $control['type'] ) {
|
83 |
+
include_once( KIRKI_PATH . '/includes/controls/class-kirki-customize-slider-control.php' );
|
84 |
+
} elseif ( 'sortable' == $control['type'] ) {
|
85 |
+
include_once( KIRKI_PATH . '/includes/controls/class-kirki-customize-sortable-control.php' );
|
86 |
+
} elseif ( 'switch' == $control['type'] || ( 'checkbox' == $control['type'] && isset( $control['mode'] ) && 'switch' == $control['mode'] ) ) {
|
87 |
+
include_once( KIRKI_PATH . '/includes/controls/class-kirki-customize-switch-control.php' );
|
88 |
+
} elseif ( 'toggle' == $control['type'] || ( 'checkbox' == $control['type'] && isset( $control['mode'] ) && 'toggle' == $control['mode'] ) ) {
|
89 |
+
include_once( KIRKI_PATH . '/includes/controls/class-kirki-customize-toggle-control.php' );
|
90 |
+
} elseif ( 'background' == $control['type'] ) {
|
91 |
include_once( KIRKI_PATH . '/includes/controls/class-kirki-customize-slider-control.php' );
|
92 |
}
|
93 |
}
|
101 |
|
102 |
$controls = $this->get_controls();
|
103 |
$kirki_settings = new Kirki_Settings();
|
104 |
+
$kirki_controls = $this->controls;
|
105 |
|
106 |
// Early exit if controls are not set or if they're empty
|
107 |
if ( ! isset( $controls ) || empty( $controls ) ) {
|
164 |
}
|
165 |
|
166 |
}
|
167 |
+
endif;
|
168 |
|
169 |
+
if ( ! function_exists( 'Kirki' ) ) :
|
170 |
+
function Kirki() {
|
171 |
+
return Kirki::get_instance();
|
172 |
+
}
|
173 |
+
endif;
|
174 |
+
// Global for backwards compatibility.
|
175 |
+
$GLOBALS['kirki'] = Kirki();
|
176 |
global $kirki;
|
|
|
177 |
|
178 |
+
|
179 |
+
/**
|
180 |
+
* A wrapper function for get_theme_mod.
|
181 |
+
*
|
182 |
+
* This will be a bit more generic and will future-proof the plugin
|
183 |
+
* in case we ever decide to switch to using options instead of theme mods.
|
184 |
+
*
|
185 |
+
* An additional benefit is that it also gets the default values
|
186 |
+
* without the need to manually define them like in get_theme_mod();
|
187 |
+
*
|
188 |
+
* It's recommended that you add the following to your theme/plugin before using this function:
|
189 |
+
*
|
190 |
+
|
191 |
+
if ( ! function_exists( 'kirki_get_option' ) ) :
|
192 |
+
function kirki_get_option( $option ) {
|
193 |
+
get_theme_mod( $option, '' );
|
194 |
+
}
|
195 |
endif;
|
196 |
+
|
197 |
+
*
|
198 |
+
* This will NOT get the right value, but at least no fatal errors will occur in case the plugin is not installed.
|
199 |
+
*/
|
200 |
+
function kirki_get_option( $option ) {
|
201 |
+
|
202 |
+
global $kirki;
|
203 |
+
|
204 |
+
$controls = $kirki->get_controls();
|
205 |
+
$value = '';
|
206 |
+
|
207 |
+
foreach ( $controls as $control ) {
|
208 |
+
$control = Kirki_Controls::control_clean( $control );
|
209 |
+
if ( $option == $setting ) {
|
210 |
+
$value = get_theme_mod( $control['settings'], $control['default'] );
|
211 |
+
}
|
212 |
+
|
213 |
+
}
|
214 |
+
|
215 |
+
return $value;
|
216 |
+
|
217 |
+
}
|
readme.txt
CHANGED
@@ -1,29 +1,34 @@
|
|
1 |
=== Kirki ===
|
2 |
Contributors: aristath, fovoc
|
3 |
-
|
4 |
-
|
5 |
Requires at least: 4.0
|
6 |
Tested up to: 4.1.1
|
7 |
-
Stable tag: 0.
|
8 |
License: GPLv2 or later
|
9 |
License URI: http://www.gnu.org/licenses/gpl-2.0.html
|
10 |
|
11 |
Tired of all the bloated options frameworks? You can use the WordPress Customizer instead, and extend it using Kirki!
|
12 |
|
13 |
-
== Description ==
|
14 |
|
|
|
15 |
Kirki allows developers to add advanced controls to their customizer as well as customize the way the customizer looks and feels.
|
16 |
|
|
|
|
|
|
|
|
|
17 |
The following controls are included:
|
18 |
|
19 |
-
* Buttonset
|
|
|
|
|
20 |
* Checkbox
|
21 |
* Color
|
|
|
22 |
* Image
|
23 |
* Background
|
24 |
-
* Image Radio
|
25 |
* Multicheck
|
26 |
-
* Radio
|
27 |
* Select
|
28 |
* Slider
|
29 |
* Text
|
@@ -32,23 +37,45 @@ The following controls are included:
|
|
32 |
* Switch
|
33 |
* Toggle
|
34 |
* Sortable
|
|
|
35 |
|
36 |
For documentation and examples on how to use these controls, please visit [kirki.org](http://kirki.org/#fields).
|
37 |
|
38 |
-
In addition you can also automatically generate the CSS for a lot of controls and have it added to the head of your document without writing any custom functions and code for that. [Learn more about automatic output of CSS here](http://kirki.org/#output)
|
39 |
|
40 |
== Installation ==
|
41 |
-
|
42 |
-
|
|
|
43 |
For configuration instructions please visit http://kirki.org/#configuration
|
44 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
45 |
== 0.6.2 - 2014-03-02, dev time: 3 hours ==
|
46 |
* Fix: Frontend styles were not properly enqueued (props @dmgawel)
|
47 |
* New: Allow multiple output styles per control defined as an array of arrays.
|
48 |
* Fix: Background control styles
|
49 |
* Fix: Serialise default values for the sortable control. Now you can define default values as an array.
|
50 |
* Fix: Required script
|
51 |
-
* Fix: '_opacity' was added to a lot of controls by mistake. Removed it and wrote a migration script.
|
52 |
|
53 |
== 0.6.1 - 2014-02-25, dev time: 1 hours ==
|
54 |
* Fix: Sortables controls had a JS conflict
|
@@ -64,7 +91,7 @@ For configuration instructions please visit http://kirki.org/#configuration
|
|
64 |
* New: Only load control classes when they are needed
|
65 |
* New: Introducing Kirki_Customize_Control class
|
66 |
* Fix: CSS tweaks
|
67 |
-
* New: Sortable control (creating one is identical to a select control, but with
|
68 |
* Fix: Double output CSS (props @agusmu)
|
69 |
* New: Google fonts now parsed from a json file.
|
70 |
|
@@ -75,13 +102,13 @@ For configuration instructions please visit http://kirki.org/#configuration
|
|
75 |
== 0.5 ==
|
76 |
* New: Automatic output of styles for generic controls.
|
77 |
* New: Automatic output of styles + scripts for fonts (including googlefonts )
|
78 |
-
* New: The 'output' argument on background controls is now an array for consistency with other controls. Older syntax is still compatible though. :)
|
79 |
* New: Add the ability to auto-generate styles for colors.
|
80 |
* Fix: Add a blank stylesheet if we need one and no stylesheet_id has been defined in the config options.
|
81 |
* Fix: CSS-only tooltips. Fixes issue with tooltips now showing up on WP >= 4.1
|
82 |
* Fix: Code cleanups
|
83 |
-
* New: Added support for WordPress's transport arguments
|
84 |
-
* Fix: All controls now have a sanitization callback. Users can override the default sanitizations by adding their own 'sanitize_callback' argument.
|
85 |
* Fix: OOP rewrite
|
86 |
* Fix: Strip protocol from Google API link
|
87 |
* Fix: Loading order for some files
|
@@ -91,14 +118,14 @@ For configuration instructions please visit http://kirki.org/#configuration
|
|
91 |
* Fix: bugfix for selector
|
92 |
* New: Change the Kirki theme based on which admin theme is selected.
|
93 |
* Fix: Tranlsation domain issue
|
94 |
-
* New: Added a "group_title" control
|
95 |
* Fix: Updated the required script
|
96 |
* Fix: Updating CSS
|
97 |
* Other minor improvements and bugfixes
|
98 |
|
99 |
= 0.3 =
|
100 |
* new: added background field
|
101 |
-
* new: added 'output' argument to directly output the CSS
|
102 |
|
103 |
= 0.2 =
|
104 |
* Initial version
|
1 |
=== Kirki ===
|
2 |
Contributors: aristath, fovoc
|
3 |
+
Tags: customizer, options famework, theme mods
|
4 |
+
Donate link: http://kirki.org/
|
5 |
Requires at least: 4.0
|
6 |
Tested up to: 4.1.1
|
7 |
+
Stable tag: 0.7
|
8 |
License: GPLv2 or later
|
9 |
License URI: http://www.gnu.org/licenses/gpl-2.0.html
|
10 |
|
11 |
Tired of all the bloated options frameworks? You can use the WordPress Customizer instead, and extend it using Kirki!
|
12 |
|
|
|
13 |
|
14 |
+
== Description ==
|
15 |
Kirki allows developers to add advanced controls to their customizer as well as customize the way the customizer looks and feels.
|
16 |
|
17 |
+
You can add beautiful options to your theme\'s customizer panel and allow your users to tweak any aspect of their theme. You\'ve got 18 control types that you can use ( 9 default + 9 custom-made ), styling options for the customizer, as well as automatic calculations for your styles using the `output` argument on your controls.
|
18 |
+
|
19 |
+
Converting from the default customizer to the syntax used by Kirki will only take a few minutes and will save you a lot of time in the long run. P)
|
20 |
+
|
21 |
The following controls are included:
|
22 |
|
23 |
+
* Radio-Buttonset
|
24 |
+
* Radio-Image
|
25 |
+
* Radio
|
26 |
* Checkbox
|
27 |
* Color
|
28 |
+
* Dropdown Pages
|
29 |
* Image
|
30 |
* Background
|
|
|
31 |
* Multicheck
|
|
|
32 |
* Select
|
33 |
* Slider
|
34 |
* Text
|
37 |
* Switch
|
38 |
* Toggle
|
39 |
* Sortable
|
40 |
+
* Number
|
41 |
|
42 |
For documentation and examples on how to use these controls, please visit [kirki.org](http://kirki.org/#fields).
|
43 |
|
|
|
44 |
|
45 |
== Installation ==
|
46 |
+
From your dashboarad go to Plugins => Add New.
|
47 |
+
Search for \"Kirki\" and install it.
|
48 |
+
Once you isntall it, activate it.
|
49 |
For configuration instructions please visit http://kirki.org/#configuration
|
50 |
|
51 |
+
|
52 |
+
== Changelog ==
|
53 |
+
== 0.7 - 2014-03-14, dev time: 10 hours ==
|
54 |
+
* Fix: Array to string conversion that happened conditionally when used with googlefonts. (props @groucho75)
|
55 |
+
* Fix: Background opacity affects background-position of bg image
|
56 |
+
* Fix: font-weight not being applied on google fonts
|
57 |
+
* New: Added `kirki_get_option( $setting );` function that also gets default values
|
58 |
+
* Tweak: Singleton for main plugin class
|
59 |
+
* Fix: Prevent empty help tooltips
|
60 |
+
* New: Added `toggle` control
|
61 |
+
* New: Added `switch` control
|
62 |
+
* Fix: Color controls were not being reset to default:
|
63 |
+
* Tweak: Tooltips now loaded via jQuery
|
64 |
+
* Tweak: Renamed `setting` to settings for consistency with WordPress core
|
65 |
+
* Tweak: Renamed `description` to `help` and `subtitle` to `description for consistency with WordPress core
|
66 |
+
* Tweak: Backwards-compatibility improvements
|
67 |
+
* New: Allow hiding background control elements by not including default values for them
|
68 |
+
* Tweak: Performance improvements
|
69 |
+
* Tweak: Using WordPress core controls instead of custom ones when those are available
|
70 |
+
* Tweak: Separate logic for multiple-type controls that were using the "mode" argument. This has been deprecated in favor of completely separate control types.
|
71 |
+
|
72 |
== 0.6.2 - 2014-03-02, dev time: 3 hours ==
|
73 |
* Fix: Frontend styles were not properly enqueued (props @dmgawel)
|
74 |
* New: Allow multiple output styles per control defined as an array of arrays.
|
75 |
* Fix: Background control styles
|
76 |
* Fix: Serialise default values for the sortable control. Now you can define default values as an array.
|
77 |
* Fix: Required script
|
78 |
+
* Fix: \'_opacity\' was added to a lot of controls by mistake. Removed it and wrote a migration script.
|
79 |
|
80 |
== 0.6.1 - 2014-02-25, dev time: 1 hours ==
|
81 |
* Fix: Sortables controls had a JS conflict
|
91 |
* New: Only load control classes when they are needed
|
92 |
* New: Introducing Kirki_Customize_Control class
|
93 |
* Fix: CSS tweaks
|
94 |
+
* New: Sortable control (creating one is identical to a select control, but with `\'type\' => \'sortable\'`)
|
95 |
* Fix: Double output CSS (props @agusmu)
|
96 |
* New: Google fonts now parsed from a json file.
|
97 |
|
102 |
== 0.5 ==
|
103 |
* New: Automatic output of styles for generic controls.
|
104 |
* New: Automatic output of styles + scripts for fonts (including googlefonts )
|
105 |
+
* New: The \'output\' argument on background controls is now an array for consistency with other controls. Older syntax is still compatible though. :)
|
106 |
* New: Add the ability to auto-generate styles for colors.
|
107 |
* Fix: Add a blank stylesheet if we need one and no stylesheet_id has been defined in the config options.
|
108 |
* Fix: CSS-only tooltips. Fixes issue with tooltips now showing up on WP >= 4.1
|
109 |
* Fix: Code cleanups
|
110 |
+
* New: Added support for WordPress\'s transport arguments
|
111 |
+
* Fix: All controls now have a sanitization callback. Users can override the default sanitizations by adding their own \'sanitize_callback\' argument.
|
112 |
* Fix: OOP rewrite
|
113 |
* Fix: Strip protocol from Google API link
|
114 |
* Fix: Loading order for some files
|
118 |
* Fix: bugfix for selector
|
119 |
* New: Change the Kirki theme based on which admin theme is selected.
|
120 |
* Fix: Tranlsation domain issue
|
121 |
+
* New: Added a \"group_title\" control
|
122 |
* Fix: Updated the required script
|
123 |
* Fix: Updating CSS
|
124 |
* Other minor improvements and bugfixes
|
125 |
|
126 |
= 0.3 =
|
127 |
* new: added background field
|
128 |
+
* new: added \'output\' argument to directly output the CSS
|
129 |
|
130 |
= 0.2 =
|
131 |
* Initial version
|