diff --git a/css/customizer.css b/css/customizer.css
index 6d406bd..f2fd009 100644
--- a/css/customizer.css
+++ b/css/customizer.css
@@ -105,17 +105,21 @@ input[type="number"]:focus {
display: block;
clear: both;
}
+
.text_radio_button_control .radio-buttons {
display: inline-block;
border: 1px solid #f9f9fe;
}
+
.text_radio_button_control .radio-button-label {
cursor: pointer;
float: left;
}
+
.text_radio_button_control .radio-button-label > input {
display: none;
}
+
.text_radio_button_control .radio-button-label span {
cursor: pointer;
font-weight: 500;
@@ -125,14 +129,17 @@ input[type="number"]:focus {
padding: 5px 15px;
display: inline-block;
}
+
.text_radio_button_control .radio-button-label span:hover {
background-color: rgba(255, 255, 255, .2);
color: #2885bb;
}
+
.text_radio_button_control .radio-button-label > input:checked + span {
background-color: #2084bd;
color: #fff;
}
+
.text_radio_button_control .radio-button-label > input:checked + span:hover {
color: #fff;
}
@@ -143,10 +150,12 @@ input[type="number"]:focus {
.image_radio_button_control .radio-button-label > input {
display: none;
}
+
.image_radio_button_control .radio-button-label > img {
cursor: pointer;
border: 3px solid #ddd;
}
+
.image_radio_button_control .radio-button-label > input:checked + img {
border: 3px solid #2885bb;
}
@@ -157,93 +166,200 @@ input[type="number"]:focus {
.image_checkbox_control .checkbox-label > input {
display: none;
}
+
.image_checkbox_control .checkbox-label > img {
cursor: pointer;
border: 3px solid #ddd;
}
+
.image_checkbox_control .checkbox-label > input:checked + img {
border: 3px solid #2885bb;
}
+/* ==========================================================================
+ Pill Checkboxes
+ ========================================================================== */
+.pill_checkbox_control .checkbox-label > input {
+ display: none;
+}
+
+.pill_checkbox_control .checkbox-label > .sortable-pill-title {
+ box-sizing: border-box;
+ cursor: pointer;
+ background-color: #ddd;
+ padding: 5px 15px;
+ border-radius: 20px;
+ font-size: 1rem;
+ display: inline-block;
+ margin-bottom: 5px
+}
+
+.pill_checkbox_control .sortable .checkbox-label > .sortable-pill-title {
+ cursor: move;
+}
+
+.pill_checkbox_control .sortable.fullwidth_pills .checkbox-label > .sortable-pill-title {
+ cursor: pointer;
+}
+
+.pill_checkbox_control .checkbox-label > input:checked + .sortable-pill-title {
+ background-color: #2084bd;
+ color: #fff;
+}
+
+.pill_checkbox_control .checkbox-label > input:checked + .sortable-pill-title:before {
+ display: inline-block;
+ font-style: normal;
+ font-variant: normal;
+ text-rendering: auto;
+ -webkit-font-smoothing: antialiased;
+ font-family: "dashicons";
+ font-weight: normal;
+ font-size: 24px;
+ content: "\f147";
+ margin-left: -10px;
+ vertical-align: bottom;
+}
+
+.pill_checkbox_control .fullwidth_pills .checkbox-label > .sortable-pill-title {
+ width: 100%;
+ border-radius: 0;
+}
+
+.pill_checkbox_control .sortable.fullwidth_pills .checkbox-label > .sortable-pill-title {
+ width: 90%;
+}
+
+.pill-ui-state-highlight {
+ display: inline-block;
+ padding: 5px 15px;
+ border-radius: 20px;
+ font-size: 1rem;
+ border: 1px dotted #2084bd;
+ margin-bottom: 5px;
+ height: 16px;
+}
+
+.pill_checkbox_control .sortable_pills .pill-ui-state-highlight {
+ width: 50px;
+ border-radius: 20px;
+}
+
+.pill_checkbox_control .sortable_pills.fullwidth_pills .pill-ui-state-highlight {
+ width: 90%;
+ border-radius: 0;
+}
+
+.pill_checkbox_control .dashicons-sort {
+ margin: 5px 0 0 1px;
+ color: #d4d4d4;
+ cursor: move;
+}
+
+.pill_checkbox_control .dashicons-sort:hover {
+ color: #a7a7a7;
+}
+
+.pill_checkbox_control .sortable_pills.fullwidth_pills .ui-sortable-helper {
+ width: calc(100% - 25px) !important;
+}
+
/* ==========================================================================
Slider
========================================================================== */
.slider-custom-control {
margin-bottom: 30px;
}
+
.slider-custom-control input[type=number]::-webkit-inner-spin-button,
.slider-custom-control input[type=number]::-webkit-outer-spin-button {
-webkit-appearance: none;
margin: 0;
}
+
.slider-custom-control input[type=number] {
-moz-appearance: textfield;
}
+
.slider-custom-control .customize-control-title {
display: inline-block;
}
+
.slider-custom-control input[type=number] {
text-align: right;
width: 50px;
float: right;
}
+
.slider-custom-control .slider {
width: 85%;
float: left;
margin: 20px 0 10px;
}
+
.slider-custom-control .slider-reset {
float: right;
cursor: pointer;
}
+
.slider-custom-control .slider-value {
border: none;
text-align: right;
width: 50px;
margin-right: 5px;
}
+
.slider-custom-control .slider-value,
.slider-custom-control .slider-unit {
float: right;
}
+
.slider-custom-control .ui-widget.ui-widget-content {
border: 1px solid #f4f4f4;
}
+
.slider-custom-control .ui-corner-all,
.slider-custom-control .ui-corner-bottom,
.slider-custom-control .ui-corner-right,
.slider-custom-control .ui-corner-br {
border-bottom-right-radius: 3px;
}
+
.slider-custom-control .ui-corner-all,
.slider-custom-control .ui-corner-bottom,
.slider-custom-control .ui-corner-left,
.slider-custom-control .ui-corner-bl {
border-bottom-left-radius: 3px;
}
+
.slider-custom-control .ui-corner-all,
.slider-custom-control .ui-corner-top,
.slider-custom-control .ui-corner-right,
.slider-custom-control .ui-corner-tr {
border-top-right-radius: 3px;
}
+
.slider-custom-control .ui-corner-all,
.slider-custom-control .ui-corner-top,
.slider-custom-control .ui-corner-left,
.slider-custom-control .ui-corner-tl {
border-top-left-radius: 3px;
}
+
.slider-custom-control .ui-widget-content {
background: #f4f4f4 none repeat scroll 0 0;
color: #333;
}
+
.slider-custom-control .ui-slider-horizontal {
height: 3px;
}
+
.slider-custom-control .ui-slider {
position: relative;
text-align: left;
}
+
.slider-custom-control .ui-state-default,
.slider-custom-control .ui-widget-content .ui-state-default,
.slider-custom-control .ui-widget-header .ui-state-default,
@@ -255,11 +371,13 @@ input[type="number"]:focus {
color: #454545;
font-weight: normal;
}
+
.slider-custom-control .ui-slider-horizontal .ui-slider-handle {
margin-left: -7px;
top: -7px;
border-radius: 50%;
}
+
.slider-custom-control .ui-slider .ui-slider-handle {
cursor: pointer;
height: 14px;
@@ -267,11 +385,13 @@ input[type="number"]:focus {
width: 14px;
z-index: 2;
}
+
.slider-custom-control .dashicons-image-rotate {
margin-top: 10px;
color: #d4d4d4;
size: 16px;
}
+
.slider-custom-control .dashicons-image-rotate:hover {
color: #a7a7a7;
}
@@ -373,34 +493,42 @@ input[type="number"]:focus {
margin: 0;
padding: 0;
}
+
.sortable input[type="text"] {
margin: 5px 5px 5px 0;
width: 80%;
}
+
.sortable div {
cursor: move;
}
+
.customize-control-sortable-repeater-delete {
color: #d4d4d4;
}
+
.customize-control-sortable-repeater-delete:hover {
color: #f00;
}
+
.customize-control-sortable-repeater-delete .dashicons-no-alt {
text-decoration: none;
margin: 8px 0 0 0;
font-weight: 600;
}
+
.customize-control-sortable-repeater-delete:active,
.customize-control-sortable-repeater-delete:focus {
outline: none;
-webkit-box-shadow: none;
box-shadow: none;
}
+
.repeater .dashicons-sort {
margin: 8px 5px 0 5px;
color: #d4d4d4;
}
+
.repeater .dashicons-sort:hover {
color: #a7a7a7;
}
@@ -415,6 +543,7 @@ input[type="number"]:focus {
padding: 10px 5px 5px 0;
cursor: pointer;
}
+
.accordion-icon-toggle {
font-size: 18px;
margin-left: 5px;
@@ -424,6 +553,7 @@ input[type="number"]:focus {
-o-transition: -o-transform 0.3s ease-in-out;
transition: transform 0.3s ease-in-out;
}
+
.single-accordion-toggle-rotate .accordion-icon-toggle {
filter: progid: DXImageTransform.Microsoft.BasicImage(rotation=-0.5);
-webkit-transform: rotate(-45deg);
@@ -433,13 +563,16 @@ input[type="number"]:focus {
transform: rotate(-45deg);
display: inline-block;
}
+
.single-accordion {
display: none;
}
+
.single-accordion ul {
margin: 0;
padding: 0;
}
+
.single-accordion li {
background-color: #e4e4e4;
color: #888;
@@ -449,6 +582,7 @@ input[type="number"]:focus {
margin: 5px;
text-align: center;
}
+
.single-accordion li i {
margin-left: 5px;
}
@@ -536,7 +670,6 @@ input[type="number"]:focus {
line-height: 27px;
margin-left: -14px;
}
-
.alpha-color-picker-container .ui-slider-handle.show-opacity {
font-size: 12px;
}
@@ -585,18 +718,11 @@ input[type="number"]:focus {
========================================================================== */
.customize-control-color .wp-color-result,
.customize-control-alpha-color .wp-color-result {
- border: none;
box-shadow: none;
}
-.customize-control-color .wp-color-result:after,
-.customize-control-alpha-color .wp-color-result:after {
- border: none;
-}
-
.customize-control-color .wp-color-result .wp-color-result-text,
.customize-control-alpha-color .wp-color-result .wp-color-result-text {
- line-height: 24px;
border-left: none;
}
@@ -618,12 +744,8 @@ input[type="number"]:focus {
WPColorPicker Alpha Color Picker
========================================================================== */
.customize-control-wpcolorpicker-alpha-color .wp-color-result {
- border: none;
box-shadow: none;
}
-.customize-control-wpcolorpicker-alpha-color .wp-color-result {
- border: none;
-}
.customize-control-wpcolorpicker-alpha-color .wp-picker-input-wrap input[type="text"].wp-color-picker {
float: left;
@@ -631,7 +753,6 @@ input[type="number"]:focus {
}
.customize-control-wpcolorpicker-alpha-color .wp-color-result .wp-color-result-text {
- line-height: 24px;
border-left: none;
}
@@ -649,6 +770,7 @@ input[type="number"]:focus {
#customize-theme-controls #accordion-section-upsell_section {
display: block !important;
}
+
#customize-theme-controls .upsell-section-title {
font-size: 14px;
border-bottom: 1px solid #ddd;
@@ -664,6 +786,7 @@ input[type="number"]:focus {
-ms-user-select: none;
user-select: none;
}
+
#customize-theme-controls .upsell-section-title::after {
position: absolute;
top: 12px;
@@ -677,6 +800,7 @@ input[type="number"]:focus {
-moz-osx-font-smoothing: grayscale;
text-decoration: none !important;
}
+
#customize-theme-controls .upsell-section-title a {
display: block;
padding: 12px 15px 15px;
diff --git a/functions.php b/functions.php
index c4f67c4..31b7c7f 100644
--- a/functions.php
+++ b/functions.php
@@ -94,7 +94,7 @@ function skyrocket_generate_social_urls() {
* Return an unordered list of linked social media icons, based on the urls provided in the Customizer Sortable Repeater
* This is a sample function to display some social icons on your site.
* This sample function is also used to show how you can call a PHP function to refresh the customizer preview.
- * Add the following to header.php if you want to see the sample social icons displayed in the customizer preview and your theme.
+ * Add the following code to header.php if you want to see the sample social icons displayed in the customizer preview and your theme.
* Before any social icons display, you'll also need to add the relevent URL's to the Header Navigation > Social Icons section in the Customizer.
*
*
@@ -225,6 +225,10 @@ function skyrocket_generate_defaults() {
'sample_single_accordion' => '',
'sample_alpha_color' => 'rgba(209,0,55,0.7)',
'sample_wpcolorpicker_alpha_color' => 'rgba(55,55,55,0.5)',
+ 'sample_wpcolorpicker_alpha_color2' => 'rgba(33,33,33,0.8)',
+ 'sample_pill_checkbox' => 'tiger,elephant,hippo',
+ 'sample_pill_checkbox2' => 'captainmarvel,msmarvel,squirrelgirl',
+ 'sample_pill_checkbox3' => 'author,categories,comments',
'sample_simple_notice' => '',
'sample_dropdown_select2_control_single' => 'vic',
'sample_dropdown_select2_control_multi' => 'Antarctica/McMurdo,Australia/Melbourne,Australia/Broken_Hill',
diff --git a/inc/custom-controls.php b/inc/custom-controls.php
index a2e459d..b835834 100644
--- a/inc/custom-controls.php
+++ b/inc/custom-controls.php
@@ -42,47 +42,47 @@ protected function get_skyrocket_resource_url() {
}
/**
- * Image Check Box Custom Control
+ * Image Checkbox Custom Control
*
* @author Anthony Hortin
* @license http://www.gnu.org/licenses/gpl-2.0.html
* @link https://github.com/maddisondesigns
*/
class Skyrocket_Image_Checkbox_Custom_Control extends Skyrocket_Custom_Control {
- /**
- * The type of control being rendered
- */
- public $type = 'image_checkbox';
- /**
- * Enqueue our scripts and styles
- */
- public function enqueue() {
- wp_enqueue_style( 'skyrocket-custom-controls-css', $this->get_skyrocket_resource_url() . 'css/customizer.css', array(), '1.0', 'all' );
- }
- /**
- * Render the control in the customizer
- */
- public function render_content() {
- ?>
-
- label ) ) { ?>
-
label ); ?>
-
- description ) ) { ?>
-
description ); ?>
-
+ /**
+ * The type of control being rendered
+ */
+ public $type = 'image_checkbox';
+ /**
+ * Enqueue our scripts and styles
+ */
+ public function enqueue() {
+ wp_enqueue_style( 'skyrocket-custom-controls-css', $this->get_skyrocket_resource_url() . 'css/customizer.css', array(), '1.0', 'all' );
+ }
+ /**
+ * Render the control in the customizer
+ */
+ public function render_content() {
+ ?>
+
+ label ) ) { ?>
+
label ); ?>
+
+ description ) ) { ?>
+
description ); ?>
+
value() ) ); ?>
link(); ?> />
- choices as $key => $value ) { ?>
-
- class="multi-image-checkbox"/>
-
-
-
-
- choices as $key => $value ) { ?>
+
+ class="multi-image-checkbox"/>
+
+
+
+
+ get_skyrocket_resource_url() . 'css/customizer.css', array(), '1.0', 'all' );
- }
- /**
- * Render the control in the customizer
- */
- public function render_content() {
- ?>
-
- label ) ) { ?>
-
label ); ?>
-
- description ) ) { ?>
-
description ); ?>
-
+ /**
+ * The type of control being rendered
+ */
+ public $type = 'text_radio_button';
+ /**
+ * Enqueue our scripts and styles
+ */
+ public function enqueue() {
+ wp_enqueue_style( 'skyrocket-custom-controls-css', $this->get_skyrocket_resource_url() . 'css/customizer.css', array(), '1.0', 'all' );
+ }
+ /**
+ * Render the control in the customizer
+ */
+ public function render_content() {
+ ?>
+
-
+ get_skyrocket_resource_url() . 'css/customizer.css', array(), '1.0', 'all' );
- }
+ }
/**
* Render the control in the customizer
*/
- public function render_content() {
- ?>
+ public function render_content() {
+ ?>
label ) ) { ?>
label ); ?>
@@ -166,9 +166,9 @@ public function render_content() {
- description ) ) {
echo '
';
- foreach ( $this->description as $key => $value ) {
+ foreach ( $this->description as $key => $value ) {
echo '' . $key . wp_kses( $value, $allowed_html ) . ' ';
}
echo ' ';
@@ -361,8 +361,8 @@ class Skyrocket_Sortable_Repeater_Custom_Control extends Skyrocket_Custom_Contro
*/
public $type = 'sortable_repeater';
/**
- * Button labels
- */
+ * Button labels
+ */
public $button_labels = array();
/**
* Constructor
@@ -388,7 +388,7 @@ public function enqueue() {
*/
public function render_content() {
?>
-
+
label ) ) { ?>
label ); ?>
@@ -396,7 +396,7 @@ public function render_content() {
description ); ?>
link(); ?> />
-
+
@@ -486,8 +486,8 @@ public function render_content() {
else {
echo '
' . esc_attr( $value ) . ' ';
}
- }
- ?>
+ }
+ ?>
- * @license http://www.gnu.org/licenses/gpl-3.0.html
- * @link https://github.com/BraadMartin/components/tree/master/customizer/alpha-color-picker
- */
+ * Alpha Color Picker Custom Control
+ *
+ * @author Braad Martin
+ * @license http://www.gnu.org/licenses/gpl-3.0.html
+ * @link https://github.com/BraadMartin/components/tree/master/customizer/alpha-color-picker
+ */
class Skyrocket_Customize_Alpha_Color_Control extends Skyrocket_Custom_Control {
/**
* The type of control being rendered
@@ -865,8 +865,8 @@ public function render_content() {
* Props @kallookoo for WPColorPicker script with Alpha Channel support
*
* @author Sergio
- * @license http://www.gnu.org/licenses/gpl-3.0.html
- * @link https://github.com/kallookoo/wp-color-picker-alpha
+ * @license http://www.gnu.org/licenses/gpl-3.0.html
+ * @link https://github.com/kallookoo/wp-color-picker-alpha
*/
class Skyrocket_Alpha_Color_Control extends Skyrocket_Custom_Control {
/**
@@ -874,12 +874,12 @@ class Skyrocket_Alpha_Color_Control extends Skyrocket_Custom_Control {
*/
public $type = 'wpcolorpicker-alpha-color';
/**
- * ColorPicker Attributes
- */
+ * ColorPicker Attributes
+ */
public $attributes = "";
/**
- * Color palette defaults
- */
+ * Color palette defaults
+ */
public $defaultPalette = array(
'#000000',
'#ffffff',
@@ -920,7 +920,7 @@ public function to_json() {
*/
public function render_content() {
?>
-
+
label ) ) { ?>
label ); ?>
@@ -933,6 +933,75 @@ public function render_content() {
}
}
+ /**
+ * Sortable Pill Checkbox Custom Control
+ *
+ * @author Anthony Hortin
+ * @license http://www.gnu.org/licenses/gpl-2.0.html
+ * @link https://github.com/maddisondesigns
+ */
+ class Skyrocket_Pill_Checkbox_Custom_Control extends Skyrocket_Custom_Control {
+ /**
+ * The type of control being rendered
+ */
+ public $type = 'pill_checkbox';
+ /**
+ * Define whether the pills can be sorted using drag 'n drop. Either false or true. Default = false
+ */
+ private $sortable = false;
+ /**
+ * The width of the pills. Each pill can be auto width or full width. Default = false
+ */
+ private $fullwidth = false;
+ /**
+ * Constructor
+ */
+ public function __construct( $manager, $id, $args = array(), $options = array() ) {
+ parent::__construct( $manager, $id, $args );
+ // Check if these pills are sortable
+ if ( isset( $this->input_attrs['sortable'] ) && $this->input_attrs['sortable'] ) {
+ $this->sortable = true;
+ }
+ // Check if the pills should be full width
+ if ( isset( $this->input_attrs['fullwidth'] ) && $this->input_attrs['fullwidth'] ) {
+ $this->fullwidth = true;
+ }
+ } /**
+ * Enqueue our scripts and styles
+ */
+ public function enqueue() {
+ wp_enqueue_style( 'skyrocket-custom-controls-css', $this->get_skyrocket_resource_url() . 'css/customizer.css', array(), '1.0', 'all' );
+ }
+ /**
+ * Render the control in the customizer
+ */
+ public function render_content() {
+ ?>
+
+ label ) ) { ?>
+
label ); ?>
+
+ description ) ) { ?>
+
description ); ?>
+
+ value() ) ); ?>
+
link(); ?> />
+
+ choices as $key => $value ) { ?>
+
+ class="sortable-pill-checkbox"/>
+
+ sortable && $this->fullwidth ) { ?>
+
+
+
+
+
+
+ manager->get_control( $setting->id )->choices;
+ $choices = $setting->manager->get_control( $setting->id )->choices;
if ( array_key_exists( $input, $choices ) ) {
return $input;
@@ -1135,7 +1204,7 @@ function skyrocket_in_range( $input, $min, $max ){
if ( $input > $max ) {
$input = $max;
}
- return $input;
+ return $input;
}
}
diff --git a/inc/customizer.php b/inc/customizer.php
index 48fc813..f4dbcc9 100644
--- a/inc/customizer.php
+++ b/inc/customizer.php
@@ -689,7 +689,7 @@ public function skyrocket_register_sample_custom_controls( $wp_customize ) {
// Another Test of WPColorPicker Alpha Color Picker Control
$wp_customize->add_setting( 'sample_wpcolorpicker_alpha_color2',
array(
- 'default' => $this->defaults['sample_wpcolorpicker_alpha_color'],
+ 'default' => $this->defaults['sample_wpcolorpicker_alpha_color2'],
'transport' => 'refresh',
'sanitize_callback' => 'skyrocket_hex_rgba_sanitization'
)
@@ -715,6 +715,91 @@ public function skyrocket_register_sample_custom_controls( $wp_customize ) {
)
) );
+ // Test of Pill Checkbox Custom Control
+ $wp_customize->add_setting( 'sample_pill_checkbox',
+ array(
+ 'default' => $this->defaults['sample_pill_checkbox'],
+ 'transport' => 'refresh',
+ 'sanitize_callback' => 'skyrocket_text_sanitization'
+ )
+ );
+ $wp_customize->add_control( new Skyrocket_Pill_Checkbox_Custom_Control( $wp_customize, 'sample_pill_checkbox',
+ array(
+ 'label' => __( 'Pill Checkbox Control', 'skyrocket' ),
+ 'description' => esc_html__( 'This is a sample Pill Checkbox Control', 'skyrocket' ),
+ 'section' => 'sample_custom_controls_section',
+ 'input_attrs' => array(
+ 'sortable' => false,
+ 'fullwidth' => false,
+ ),
+ 'choices' => array(
+ 'tiger' => __( 'Tiger', 'skyrocket' ),
+ 'lion' => __( 'Lion', 'skyrocket' ),
+ 'giraffe' => __( 'Giraffe', 'skyrocket' ),
+ 'elephant' => __( 'Elephant', 'skyrocket' ),
+ 'hippo' => __( 'Hippo', 'skyrocket' ),
+ 'rhino' => __( 'Rhino', 'skyrocket' ),
+ )
+ )
+ ) );
+
+ // Test of Pill Checkbox Custom Control
+ $wp_customize->add_setting( 'sample_pill_checkbox2',
+ array(
+ 'default' => $this->defaults['sample_pill_checkbox2'],
+ 'transport' => 'refresh',
+ 'sanitize_callback' => 'skyrocket_text_sanitization'
+ )
+ );
+ $wp_customize->add_control( new Skyrocket_Pill_Checkbox_Custom_Control( $wp_customize, 'sample_pill_checkbox2',
+ array(
+ 'label' => __( 'Pill Checkbox Control', 'skyrocket' ),
+ 'description' => esc_html__( 'This is a sample Sortable Pill Checkbox Control', 'skyrocket' ),
+ 'section' => 'sample_custom_controls_section',
+ 'input_attrs' => array(
+ 'sortable' => true,
+ 'fullwidth' => false,
+ ),
+ 'choices' => array(
+ 'captainamerica' => __( 'Captain America', 'skyrocket' ),
+ 'ironman' => __( 'Iron Man', 'skyrocket' ),
+ 'captainmarvel' => __( 'Captain Marvel', 'skyrocket' ),
+ 'msmarvel' => __( 'Ms. Marvel', 'skyrocket' ),
+ 'Jessicajones' => __( 'Jessica Jones', 'skyrocket' ),
+ 'squirrelgirl' => __( 'Squirrel Girl', 'skyrocket' ),
+ 'blackwidow' => __( 'Black Widow', 'skyrocket' ),
+ 'hulk' => __( 'Hulk', 'skyrocket' ),
+ )
+ )
+ ) );
+
+ // Test of Pill Checkbox Custom Control
+ $wp_customize->add_setting( 'sample_pill_checkbox3',
+ array(
+ 'default' => $this->defaults['sample_pill_checkbox3'],
+ 'transport' => 'refresh',
+ 'sanitize_callback' => 'skyrocket_text_sanitization'
+ )
+ );
+ $wp_customize->add_control( new Skyrocket_Pill_Checkbox_Custom_Control( $wp_customize, 'sample_pill_checkbox3',
+ array(
+ 'label' => __( 'Pill Checkbox Control', 'skyrocket' ),
+ 'description' => esc_html__( 'This is a sample Sortable Fullwidth Pill Checkbox Control', 'skyrocket' ),
+ 'section' => 'sample_custom_controls_section',
+ 'input_attrs' => array(
+ 'sortable' => true,
+ 'fullwidth' => true,
+ ),
+ 'choices' => array(
+ 'date' => __( 'Date', 'skyrocket' ),
+ 'author' => __( 'Author', 'skyrocket' ),
+ 'categories' => __( 'Categories', 'skyrocket' ),
+ 'tags' => __( 'Tags', 'skyrocket' ),
+ 'comments' => __( 'Comments', 'skyrocket' ),
+ )
+ )
+ ) );
+
// Test of Simple Notice control
$wp_customize->add_setting( 'sample_simple_notice',
array(
diff --git a/js/customizer.js b/js/customizer.js
index 3d0f46c..5c2f4bf 100644
--- a/js/customizer.js
+++ b/js/customizer.js
@@ -29,14 +29,14 @@ jQuery( document ).ready(function($) {
});
// Make our Repeater fields sortable
- $(this).find('.sortable').sortable({
+ $(this).find('.sortable_repeater.sortable').sortable({
update: function(event, ui) {
skyrocketGetAllInputs($(this).parent());
}
});
// Remove item starting from it's parent element
- $('.sortable').on('click', '.customize-control-sortable-repeater-delete', function(event) {
+ $('.sortable_repeater.sortable').on('click', '.customize-control-sortable-repeater-delete', function(event) {
event.preventDefault();
var numItems = $(this).parent().parent().find('.repeater').length;
@@ -61,12 +61,12 @@ jQuery( document ).ready(function($) {
});
// Refresh our hidden field if any fields change
- $('.sortable').change(function() {
+ $('.sortable_repeater.sortable').change(function() {
skyrocketGetAllInputs($(this).parent());
})
// Add https:// to the start of the URL if it doesn't have it
- $('.sortable').on('blur', '.repeater-input', function() {
+ $('.sortable_repeater.sortable').on('blur', '.repeater-input', function() {
var url = $(this);
var val = url.val();
if(val && !val.match(/^.+:\/\/.*/)) {
@@ -171,7 +171,7 @@ jQuery( document ).ready(function($) {
});
/**
- * Image Check Box Custom Control
+ * Image Checkbox Custom Control
*
* @author Anthony Hortin
* @license http://www.gnu.org/licenses/gpl-2.0.html
@@ -179,22 +179,49 @@ jQuery( document ).ready(function($) {
*/
$('.multi-image-checkbox').on('change', function () {
- getAllCheckboxes($(this).parent().parent());
+ skyrocketGetAllImageCheckboxes($(this).parent().parent());
});
// Get the values from the checkboxes and add to our hidden field
- function getAllCheckboxes($element) {
+ function skyrocketGetAllImageCheckboxes($element) {
var inputValues = $element.find('.multi-image-checkbox').map(function() {
if( $(this).is(':checked') ) {
return $(this).val();
- // } else {
- // return '';
}
}).toArray();
// Important! Make sure to trigger change event so Customizer knows it has to save the field
$element.find('.customize-control-multi-image-checkbox').val(inputValues).trigger('change');
}
+ /**
+ * Pill Checkbox Custom Control
+ *
+ * @author Anthony Hortin
+ * @license http://www.gnu.org/licenses/gpl-2.0.html
+ * @link https://github.com/maddisondesigns
+ */
+
+ $( ".pill_checkbox_control .sortable" ).sortable({
+ placeholder: "pill-ui-state-highlight",
+ update: function( event, ui ) {
+ skyrocketGetAllPillCheckboxes($(this).parent());
+ }
+ });
+
+ $('.pill_checkbox_control .sortable-pill-checkbox').on('change', function () {
+ skyrocketGetAllPillCheckboxes($(this).parent().parent().parent());
+ });
+
+ // Get the values from the checkboxes and add to our hidden field
+ function skyrocketGetAllPillCheckboxes($element) {
+ var inputValues = $element.find('.sortable-pill-checkbox').map(function() {
+ if( $(this).is(':checked') ) {
+ return $(this).val();
+ }
+ }).toArray();
+ $element.find('.customize-control-sortable-pill-checkbox').val(inputValues).trigger('change');
+ }
+
/**
* Dropdown Select2 Custom Control
*
diff --git a/js/wp-color-picker-alpha.js b/js/wp-color-picker-alpha.js
index b089912..aaeb7b0 100644
--- a/js/wp-color-picker-alpha.js
+++ b/js/wp-color-picker-alpha.js
@@ -8,4 +8,4 @@
* https://github.com/kallookoo/wp-color-picker-alpha
* Licensed under the GPLv2 license.
*/
-!function(t){if(!t.wp.wpColorPicker.prototype._hasAlpha){var o="data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAABAAAAAQCAIAAAHnlligAAAAGXRFWHRTb2Z0d2FyZQBBZG9iZSBJbWFnZVJlYWR5ccllPAAAAHJJREFUeNpi+P///4EDBxiAGMgCCCAGFB5AADGCRBgYDh48CCRZIJS9vT2QBAggFBkmBiSAogxFBiCAoHogAKIKAlBUYTELAiAmEtABEECk20G6BOmuIl0CIMBQ/IEMkO0myiSSraaaBhZcbkUOs0HuBwDplz5uFJ3Z4gAAAABJRU5ErkJggg==",r='
',e='
',i=' ',a=void 0!==wpColorPickerL10n.current;if(a)var n=' ';else{n=' ';var l=" ",s=' '}Color.fn.toString=function(){if(this._alpha<1)return this.toCSS("rgba",this._alpha).replace(/\s+/g,"");var t=parseInt(this._color,10).toString(16);return this.error?"":(t.length<6&&(t=("00000"+t).substr(-6)),"#"+t)},t.widget("wp.wpColorPicker",t.wp.wpColorPicker,{_hasAlpha:!0,_create:function(){if(t.support.iris){var p=this,c=p.element;if(t.extend(p.options,c.data()),"hue"===p.options.type)return p._createHueOnly();p.close=t.proxy(p.close,p),p.initialValue=c.val(),c.addClass("wp-color-picker"),a?(c.hide().wrap(e),p.wrap=c.parent(),p.toggler=t(n).insertBefore(c).css({backgroundColor:p.initialValue}).attr("title",wpColorPickerL10n.pick).attr("data-current",wpColorPickerL10n.current),p.pickerContainer=t(r).insertAfter(c),p.button=t(i).addClass("hidden")):(c.parent("label").length||(c.wrap(l),p.wrappingLabelText=t(s).insertBefore(c).text(wpColorPickerL10n.defaultLabel)),p.wrappingLabel=c.parent(),p.wrappingLabel.wrap(e),p.wrap=p.wrappingLabel.parent(),p.toggler=t(n).insertBefore(p.wrappingLabel).css({backgroundColor:p.initialValue}),p.toggler.find(".wp-color-result-text").text(wpColorPickerL10n.pick),p.pickerContainer=t(r).insertAfter(p.wrappingLabel),p.button=t(i)),p.options.defaultColor?(p.button.addClass("wp-picker-default").val(wpColorPickerL10n.defaultString),a||p.button.attr("aria-label",wpColorPickerL10n.defaultAriaLabel)):(p.button.addClass("wp-picker-clear").val(wpColorPickerL10n.clear),a||p.button.attr("aria-label",wpColorPickerL10n.clearAriaLabel)),a?c.wrap(' ').after(p.button):(p.wrappingLabel.wrap(' ').after(p.button),p.inputWrapper=c.closest(".wp-picker-input-wrap")),c.iris({target:p.pickerContainer,hide:p.options.hide,width:p.options.width,mode:p.options.mode,palettes:p.options.palettes,change:function(r,e){p.options.alpha?(p.toggler.css({"background-image":"url("+o+")"}),a?p.toggler.html(' '):(p.toggler.css({position:"relative"}),0==p.toggler.find("span.color-alpha").length&&p.toggler.append(' ')),p.toggler.find("span.color-alpha").css({width:"30px",height:"24px",position:"absolute",top:0,left:0,"border-top-left-radius":"2px","border-bottom-left-radius":"2px",background:e.color.toString()})):p.toggler.css({backgroundColor:e.color.toString()}),t.isFunction(p.options.change)&&p.options.change.call(this,r,e)}}),c.val(p.initialValue),p._addListeners(),p.options.hide||p.toggler.click()}},_addListeners:function(){var o=this;o.wrap.on("click.wpcolorpicker",function(t){t.stopPropagation()}),o.toggler.click(function(){o.toggler.hasClass("wp-picker-open")?o.close():o.open()}),o.element.on("change",function(r){(""===t(this).val()||o.element.hasClass("iris-error"))&&(o.options.alpha?(a&&o.toggler.removeAttr("style"),o.toggler.find("span.color-alpha").css("backgroundColor","")):o.toggler.css("backgroundColor",""),t.isFunction(o.options.clear)&&o.options.clear.call(this,r))}),o.button.on("click",function(r){t(this).hasClass("wp-picker-clear")?(o.element.val(""),o.options.alpha?(a&&o.toggler.removeAttr("style"),o.toggler.find("span.color-alpha").css("backgroundColor","")):o.toggler.css("backgroundColor",""),t.isFunction(o.options.clear)&&o.options.clear.call(this,r),o.element.trigger("change")):t(this).hasClass("wp-picker-default")&&o.element.val(o.options.defaultColor).change()})}}),t.widget("a8c.iris",t.a8c.iris,{_create:function(){if(this._super(),this.options.alpha=this.element.data("alpha")||!1,this.element.is(":input")||(this.options.alpha=!1),void 0!==this.options.alpha&&this.options.alpha){var o=this,r=o.element,e=t('').appendTo(o.picker.find(".iris-picker-inner")),i=e.find(".iris-slider-offset-alpha"),a={aContainer:e,aSlider:i};void 0!==r.data("custom-width")?o.options.customWidth=parseInt(r.data("custom-width"))||0:o.options.customWidth=100,o.options.defaultWidth=r.width(),(o._color._alpha<1||-1!=o._color.toString().indexOf("rgb"))&&r.width(parseInt(o.options.defaultWidth+o.options.customWidth)),t.each(a,function(t,r){o.controls[t]=r}),o.controls.square.css({"margin-right":"0"});var n=o.picker.width()-o.controls.square.width()-20,l=n/6,s=n/2-l;t.each(["aContainer","strip"],function(t,r){o.controls[r].width(s).css({"margin-left":l+"px"})}),o._initControls(),o._change()}},_initControls:function(){if(this._super(),this.options.alpha){var t=this;t.controls.aSlider.slider({orientation:"vertical",min:0,max:100,step:1,value:parseInt(100*t._color._alpha),slide:function(o,r){t._color._alpha=parseFloat(r.value/100),t._change.apply(t,arguments)}})}},_change:function(){this._super();var t=this,r=t.element;if(this.options.alpha){var e=t.controls,i=parseInt(100*t._color._alpha),a=t._color.toRgb(),n=["rgb("+a.r+","+a.g+","+a.b+") 0%","rgba("+a.r+","+a.g+","+a.b+", 0) 100%"],l=t.options.defaultWidth,s=t.options.customWidth,p=t.picker.closest(".wp-picker-container").find(".wp-color-result");e.aContainer.css({background:"linear-gradient(to bottom, "+n.join(", ")+"), url("+o+")"}),p.hasClass("wp-picker-open")&&(e.aSlider.slider("value",i),t._color._alpha<1?(e.strip.attr("style",e.strip.attr("style").replace(/rgba\(([0-9]+,)(\s+)?([0-9]+,)(\s+)?([0-9]+)(,(\s+)?[0-9\.]+)\)/g,"rgb($1$3$5)")),r.width(parseInt(l+s))):r.width(l))}(r.data("reset-alpha")||!1)&&t.picker.find(".iris-palette-container").on("click.palette",".iris-palette",function(){t._color._alpha=1,t.active="external",t._change()}),r.trigger("change")},_addInputListeners:function(t){var o=this,r=function(r){var e=new Color(t.val()),i=t.val();t.removeClass("iris-error"),e.error?""!==i&&t.addClass("iris-error"):e.toString()!==o._color.toString()&&("keyup"===r.type&&i.match(/^[0-9a-fA-F]{3}$/)||o._setOption("color",e.toString()))};t.on("change",r).on("keyup",o._debounce(r,100)),o.options.hide&&t.on("focus",function(){o.show()})}})}}(jQuery),jQuery(document).ready(function(t){t(".color-picker").each(function(o,r){var e={palettes:_wpCustomizeSettings.controls[t(this).attr("id")].colorpickerpalette};t(r).wpColorPicker(e)})});
+!function(t){if(!t.wp.wpColorPicker.prototype._hasAlpha){var o="data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAABAAAAAQCAIAAAHnlligAAAAGXRFWHRTb2Z0d2FyZQBBZG9iZSBJbWFnZVJlYWR5ccllPAAAAHJJREFUeNpi+P///4EDBxiAGMgCCCAGFB5AADGCRBgYDh48CCRZIJS9vT2QBAggFBkmBiSAogxFBiCAoHogAKIKAlBUYTELAiAmEtABEECk20G6BOmuIl0CIMBQ/IEMkO0myiSSraaaBhZcbkUOs0HuBwDplz5uFJ3Z4gAAAABJRU5ErkJggg==",r='
',e='
',i=' ',a=void 0!==wpColorPickerL10n.current;if(a)var n=' ';else{n=' ';var l=" ",s=' '}Color.fn.toString=function(){if(this._alpha<1)return this.toCSS("rgba",this._alpha).replace(/\s+/g,"");var t=parseInt(this._color,10).toString(16);return this.error?"":(t.length<6&&(t=("00000"+t).substr(-6)),"#"+t)},t.widget("wp.wpColorPicker",t.wp.wpColorPicker,{_hasAlpha:!0,_create:function(){if(t.support.iris){var p=this,c=p.element;if(t.extend(p.options,c.data()),"hue"===p.options.type)return p._createHueOnly();p.close=t.proxy(p.close,p),p.initialValue=c.val(),c.addClass("wp-color-picker"),a?(c.hide().wrap(e),p.wrap=c.parent(),p.toggler=t(n).insertBefore(c).css({backgroundColor:p.initialValue}).attr("title",wpColorPickerL10n.pick).attr("data-current",wpColorPickerL10n.current),p.pickerContainer=t(r).insertAfter(c),p.button=t(i).addClass("hidden")):(c.parent("label").length||(c.wrap(l),p.wrappingLabelText=t(s).insertBefore(c).text(wpColorPickerL10n.defaultLabel)),p.wrappingLabel=c.parent(),p.wrappingLabel.wrap(e),p.wrap=p.wrappingLabel.parent(),p.toggler=t(n).insertBefore(p.wrappingLabel).css({backgroundColor:p.initialValue}),p.toggler.find(".wp-color-result-text").text(wpColorPickerL10n.pick),p.pickerContainer=t(r).insertAfter(p.wrappingLabel),p.button=t(i)),p.options.defaultColor?(p.button.addClass("wp-picker-default").val(wpColorPickerL10n.defaultString),a||p.button.attr("aria-label",wpColorPickerL10n.defaultAriaLabel)):(p.button.addClass("wp-picker-clear").val(wpColorPickerL10n.clear),a||p.button.attr("aria-label",wpColorPickerL10n.clearAriaLabel)),a?c.wrap(' ').after(p.button):(p.wrappingLabel.wrap(' ').after(p.button),p.inputWrapper=c.closest(".wp-picker-input-wrap")),c.iris({target:p.pickerContainer,hide:p.options.hide,width:p.options.width,mode:p.options.mode,palettes:p.options.palettes,change:function(r,e){p.options.alpha?(p.toggler.css({"background-image":"url("+o+")"}),a?p.toggler.html(' '):(p.toggler.css({position:"relative"}),0==p.toggler.find("span.color-alpha").length&&p.toggler.append(' ')),p.toggler.find("span.color-alpha").css({width:"30px",height:"26px",position:"absolute",top:0,left:0,"border-top-left-radius":"2px","border-bottom-left-radius":"2px",background:e.color.toString()})):p.toggler.css({backgroundColor:e.color.toString()}),t.isFunction(p.options.change)&&p.options.change.call(this,r,e)}}),c.val(p.initialValue),p._addListeners(),p.options.hide||p.toggler.click()}},_addListeners:function(){var o=this;o.wrap.on("click.wpcolorpicker",function(t){t.stopPropagation()}),o.toggler.click(function(){o.toggler.hasClass("wp-picker-open")?o.close():o.open()}),o.element.on("change",function(r){(""===t(this).val()||o.element.hasClass("iris-error"))&&(o.options.alpha?(a&&o.toggler.removeAttr("style"),o.toggler.find("span.color-alpha").css("backgroundColor","")):o.toggler.css("backgroundColor",""),t.isFunction(o.options.clear)&&o.options.clear.call(this,r))}),o.button.on("click",function(r){t(this).hasClass("wp-picker-clear")?(o.element.val(""),o.options.alpha?(a&&o.toggler.removeAttr("style"),o.toggler.find("span.color-alpha").css("backgroundColor","")):o.toggler.css("backgroundColor",""),t.isFunction(o.options.clear)&&o.options.clear.call(this,r),o.element.trigger("change")):t(this).hasClass("wp-picker-default")&&o.element.val(o.options.defaultColor).change()})}}),t.widget("a8c.iris",t.a8c.iris,{_create:function(){if(this._super(),this.options.alpha=this.element.data("alpha")||!1,this.element.is(":input")||(this.options.alpha=!1),void 0!==this.options.alpha&&this.options.alpha){var o=this,r=o.element,e=t('').appendTo(o.picker.find(".iris-picker-inner")),i=e.find(".iris-slider-offset-alpha"),a={aContainer:e,aSlider:i};void 0!==r.data("custom-width")?o.options.customWidth=parseInt(r.data("custom-width"))||0:o.options.customWidth=100,o.options.defaultWidth=r.width(),(o._color._alpha<1||-1!=o._color.toString().indexOf("rgb"))&&r.width(parseInt(o.options.defaultWidth+o.options.customWidth)),t.each(a,function(t,r){o.controls[t]=r}),o.controls.square.css({"margin-right":"0"});var n=o.picker.width()-o.controls.square.width()-20,l=n/6,s=n/2-l;t.each(["aContainer","strip"],function(t,r){o.controls[r].width(s).css({"margin-left":l+"px"})}),o._initControls(),o._change()}},_initControls:function(){if(this._super(),this.options.alpha){var t=this;t.controls.aSlider.slider({orientation:"vertical",min:0,max:100,step:1,value:parseInt(100*t._color._alpha),slide:function(o,r){t._color._alpha=parseFloat(r.value/100),t._change.apply(t,arguments)}})}},_change:function(){this._super();var t=this,r=t.element;if(this.options.alpha){var e=t.controls,i=parseInt(100*t._color._alpha),a=t._color.toRgb(),n=["rgb("+a.r+","+a.g+","+a.b+") 0%","rgba("+a.r+","+a.g+","+a.b+", 0) 100%"],l=t.options.defaultWidth,s=t.options.customWidth,p=t.picker.closest(".wp-picker-container").find(".wp-color-result");e.aContainer.css({background:"linear-gradient(to bottom, "+n.join(", ")+"), url("+o+")"}),p.hasClass("wp-picker-open")&&(e.aSlider.slider("value",i),t._color._alpha<1?(e.strip.attr("style",e.strip.attr("style").replace(/rgba\(([0-9]+,)(\s+)?([0-9]+,)(\s+)?([0-9]+)(,(\s+)?[0-9\.]+)\)/g,"rgb($1$3$5)")),r.width(parseInt(l+s))):r.width(l))}(r.data("reset-alpha")||!1)&&t.picker.find(".iris-palette-container").on("click.palette",".iris-palette",function(){t._color._alpha=1,t.active="external",t._change()}),r.trigger("change")},_addInputListeners:function(t){var o=this,r=function(r){var e=new Color(t.val()),i=t.val();t.removeClass("iris-error"),e.error?""!==i&&t.addClass("iris-error"):e.toString()!==o._color.toString()&&("keyup"===r.type&&i.match(/^[0-9a-fA-F]{3}$/)||o._setOption("color",e.toString()))};t.on("change",r).on("keyup",o._debounce(r,100)),o.options.hide&&t.on("focus",function(){o.show()})}})}}(jQuery),jQuery(document).ready(function(t){t(".color-picker").each(function(o,r){var e={palettes:_wpCustomizeSettings.controls[t(this).attr("id")].colorpickerpalette};t(r).wpColorPicker(e)})});
diff --git a/readme.md b/readme.md
index 91222a4..2a261a2 100644
--- a/readme.md
+++ b/readme.md
@@ -4,7 +4,7 @@
**Author URI:** https://maddisondesigns.com
**License:** GNU General Public License v2 or later
**License URI:** http://www.gnu.org/licenses/gpl-2.0.html
-**Version:** 1.0.13
+**Version:** 1.1.0
## Description ##
@@ -45,6 +45,7 @@ TinyMCE Editor
Google Font Select
Alpha Color
WPColorPicker Alpha Color
+Sortable Pill Checkbox Custom Control
Upsell Section
### Toggle Switch ###
@@ -906,6 +907,132 @@ $wp_customize->add_control( new Skyrocket_Alpha_Color_Control( $wp_customize, 's
) );
````
+### Sortable Pill Checkbox Custom Control ###
+
+The Sortable Pill Checkbox works similar to an ordinary checkbox control, in that you can select one or more items out of a number of items. Instead of checkboxes, this control will display each item as a small 'pill'. When each pill/checkbox is selected, as well as changing color, the selected item will also display a tick to improve accessibility and to make it more obvious as to whether an item is selected or not. These pill checkboxes also have the option to be sortable using drag 'n drop. This is useful where you want to provide your users with a set of options, as well as providing them the ability to control the order of those options. Lastly, rather than small variabled sized pills, you can also opt to display them fullwidth. This will show each pill the same size, rather than each having a variable width. A common use of this type of control is where you might allow a user to select what meta content to display for their blog posts, along with allowing them to change the order that each item is displayed in.
+
+When adding your control, you can specify whether you want the pills to be sortable by setting `'sortable' => true` (default is non-sortable i.e. false). You can also spcify if you want the pills displayed full width by setting `'fullwidth' => true` (default is variable width i.e. false).
+
+The setting that gets saved to the database is a comma-separated string of values for each of the items that are selected.
+
+![Image Checkbox](https://maddisondesigns.com/wp-content/uploads/2017/05/SortablePillCheckbox.jpg "Sortable Pill Checkbox")
+
+**Usage**
+add_control( $id, $args );
+
+**Parameters**
+**$id** - (string) (required) The id of the Setting associated with this Control. Default: None
+
+**$args** - (array) (required) An associative array containing arguments for the setting. Default: None
+
+**Arguments for $args**
+**label** - Optional. The label that will be displayed Default: Blank
+**description** - Optional. The description to display under the label. Default: Blank.
+**section** - Required. The Section where there control should appear
+**input_attrs** - Optional. List of control options.
+ **sortable** - Optional. Allow the pills to be sortable using drag 'n drop. Default = 'false'
+ **fullwidth** - Optional. Display the pills fullwidth, instead of variable width. Default = 'false'
+**choices** - Required. List of custom choices.
+ **key** - Required. Data that will be stored for the setting
+ **value** - Required. Text to display in the control
+
+**Example 1**
+
+````
+// Test of Pill Checkbox Custom Control
+$wp_customize->add_setting( 'sample_pill_checkbox',
+ array(
+ 'default' => 'tiger,elephant,hippo',
+ 'transport' => 'refresh',
+ 'sanitize_callback' => 'skyrocket_text_sanitization'
+ )
+);
+$wp_customize->add_control( new Skyrocket_Pill_Checkbox_Custom_Control( $wp_customize, 'sample_pill_checkbox',
+ array(
+ 'label' => __( 'Pill Checkbox Control', 'skyrocket' ),
+ 'description' => esc_html__( 'This is a sample Pill Checkbox Control', 'skyrocket' ),
+ 'section' => 'sample_custom_controls_section',
+ 'input_attrs' => array(
+ 'sortable' => false,
+ 'fullwidth' => false,
+ ),
+ 'choices' => array(
+ 'tiger' => __( 'Tiger', 'skyrocket' ),
+ 'lion' => __( 'Lion', 'skyrocket' ),
+ 'giraffe' => __( 'Giraffe', 'skyrocket' ),
+ 'elephant' => __( 'Elephant', 'skyrocket' ),
+ 'hippo' => __( 'Hippo', 'skyrocket' ),
+ 'rhino' => __( 'Rhino', 'skyrocket' ),
+ )
+ )
+) );
+````
+
+**Example 2**
+
+````
+// Test of Pill Checkbox Custom Control with Sortable option
+$wp_customize->add_setting( 'sample_pill_checkbox2',
+ array(
+ 'default' => 'captainmarvel,msmarvel,squirrelgirl',
+ 'transport' => 'refresh',
+ 'sanitize_callback' => 'skyrocket_text_sanitization'
+ )
+);
+$wp_customize->add_control( new Skyrocket_Pill_Checkbox_Custom_Control( $wp_customize, 'sample_pill_checkbox2',
+ array(
+ 'label' => __( 'Pill Checkbox Control', 'skyrocket' ),
+ 'description' => esc_html__( 'This is a sample Sortable Pill Checkbox Control', 'skyrocket' ),
+ 'section' => 'sample_custom_controls_section',
+ 'input_attrs' => array(
+ 'sortable' => true,
+ 'fullwidth' => false,
+ ),
+ 'choices' => array(
+ 'captainamerica' => __( 'Captain America', 'skyrocket' ),
+ 'ironman' => __( 'Iron Man', 'skyrocket' ),
+ 'captainmarvel' => __( 'Captain Marvel', 'skyrocket' ),
+ 'msmarvel' => __( 'Ms. Marvel', 'skyrocket' ),
+ 'Jessicajones' => __( 'Jessica Jones', 'skyrocket' ),
+ 'squirrelgirl' => __( 'Squirrel Girl', 'skyrocket' ),
+ 'blackwidow' => __( 'Black Widow', 'skyrocket' ),
+ 'hulk' => __( 'Hulk', 'skyrocket' ),
+ )
+ )
+) );
+````
+
+**Example 3**
+
+````
+// Test of Pill Checkbox Custom Control with Sortable and Fullwidth options
+$wp_customize->add_setting( 'sample_pill_checkbox3',
+ array(
+ 'default' => 'author,categories,comments',
+ 'transport' => 'refresh',
+ 'sanitize_callback' => 'skyrocket_text_sanitization'
+ )
+);
+$wp_customize->add_control( new Skyrocket_Pill_Checkbox_Custom_Control( $wp_customize, 'sample_pill_checkbox3',
+ array(
+ 'label' => __( 'Pill Checkbox Control', 'skyrocket' ),
+ 'description' => esc_html__( 'This is a sample Sortable Fullwidth Pill Checkbox Control', 'skyrocket' ),
+ 'section' => 'sample_custom_controls_section',
+ 'input_attrs' => array(
+ 'sortable' => true,
+ 'fullwidth' => true,
+ ),
+ 'choices' => array(
+ 'date' => __( 'Date', 'skyrocket' ),
+ 'author' => __( 'Author', 'skyrocket' ),
+ 'categories' => __( 'Categories', 'skyrocket' ),
+ 'tags' => __( 'Tags', 'skyrocket' ),
+ 'comments' => __( 'Comments', 'skyrocket' ),
+ )
+ )
+) );
+````
+
### Upsell Section ###
The Upsell Section is a Custom Section that allows you to provide a link to an external URL, such as a theme website. This section is useful if you're upselling premium themes or plugins.
@@ -958,6 +1085,10 @@ Download a sample theme showing how to implement these Controls:
## Changelog ##
+= 1.1.0 =
+- Added new Sortable Pill Checkbox Custom Control
+- Tidied up code
+
= 1.0.13 =
- Don't enqueue the Font Awesome stylesheet within the Skyrocket_Single_Accordion_Custom_Control Control as it's not actually needed.
- Enqueue the Font Awesome stylesheet within functions.php when viewing the Customizer, for showing icons in our sample Single Accordion Control content.
diff --git a/style.css b/style.css
index 7a41285..b38ddfc 100644
--- a/style.css
+++ b/style.css
@@ -39,7 +39,7 @@
}
.social-icons a:visited {
- color: #3a3a3a;
+ color: #21759b;
}
.social-icons a:hover,