diff --git a/README.md b/README.md
index 8fa3589..5d90669 100755
--- a/README.md
+++ b/README.md
@@ -29,12 +29,14 @@ The Customizer Library currently supports these options:
* Checkbox
* Select
* Radio
+* Radio Images
* Upload
* Image
* Color
* Text
* URL
* Range
+* Arbitrary Text
* Textarea
* Select (Typography)
@@ -146,6 +148,7 @@ $options['example-select'] = array(
### Drop Down Pages
+~~~php
$options['example-dropdown-pages'] = array(
'id' => 'example-dropdown-pages',
'label' => __( 'Example Drop Down Pages', 'textdomain' ),
@@ -174,6 +177,35 @@ $options['example-radio'] = array(
);
~~~
+### Radio Images
+
+The radio images will need to be placed in the theme's images folder or adjut the image path accordingly.
+
+~~~php
+
+$imagepath = get_template_directory_uri() . '/img/';
+
+$image_choices = array(
+ 'choice-1' => array(
+ 'url' => $imagepath .'example-1.png',
+ 'label' => 'Left'
+ ),
+ 'choice-2' => array(
+ 'url' => $imagepath .'example-2.png',
+ 'label' => 'Right'
+ ),
+);
+
+$options['example-radio-images'] = array(
+ 'id' => 'example-radio-images',
+ 'label' => __( 'Example Radio Images', 'demo' ),
+ 'section' => $section,
+ 'type' => 'radio-image',
+ 'choices' => $image_choices,
+ 'default' => 'choice-2'
+);
+~~~
+
### Upload
~~~php
@@ -241,6 +273,20 @@ $options['example-range'] = array(
);
~~~
+### Arbitary Text
+
+Adding arbitary text can be helpful for including additional instructions or notation for a control, panel, or section.
+
+~~~php
+$options['example-arbitrary-text'] = array(
+ 'id' => 'example-arbitrary-text',
+ 'section' => $section,
+ 'label' => __( 'Text Label', 'demo' ),
+ 'type' => 'helptext',
+ 'description' => __( 'Example of more decription text', 'demo' )
+);
+~~~
+
### Pass $options to Customizer Library
After all the options and sections are defined, load them with the Customizer Library:
diff --git a/custom-controls/help-text.php b/custom-controls/help-text.php
new file mode 100644
index 0000000..0899ef1
--- /dev/null
+++ b/custom-controls/help-text.php
@@ -0,0 +1,23 @@
+' . esc_html( $this->label ) . '';
+ echo '
' . $this->description . '
';
+ echo '
';
+
+ }
+
+}
\ No newline at end of file
diff --git a/custom-controls/radio-image.php b/custom-controls/radio-image.php
new file mode 100644
index 0000000..6d2f754
--- /dev/null
+++ b/custom-controls/radio-image.php
@@ -0,0 +1,80 @@
+choices ) )
+ return; ?>
+
+ label ) ) : ?>
+ label ); ?>
+
+
+ description ) ) : ?>
+ description; ?>
+
+
+ id}" ); ?>">
+
+ choices as $value => $args ) : ?>
+
+
id}" ); ?>" id="id}-{$value}" ); ?>" link(); ?> value(), $value ); ?> />
+
+
+
+
+
+
+
+
+
+
+
+ add_control(
+ new Customizer_Library_Help_Text(
+ $wp_customize,
+ $option['id'], array(
+ 'label' => $option['label'],
+ 'section' => $option['section'],
+ 'priority' => $option['priority'],
+ 'description' => $option['description'],
+ 'sanitize_callback' => $option['sanitize_callback']
+ )
+ )
+ );
+
+ break;
+
+ case 'radio-image':
+
+ $wp_customize->add_control(
+ new Customizer_Library_Control_Radio_Image(
+ $wp_customize,
+ $option['id'], array(
+ 'label' => $option['label'],
+ 'section' => $option['section'],
+ 'priority' => $option['priority'],
+ 'description' => $option['description'],
+ 'sanitize_callback' => $option['sanitize_callback'],
+ 'choices' => $option['choices']
+ )
+ )
+ );
+
+ break;
+
}
}
}
@@ -228,7 +263,8 @@ function customizer_library_add_setting( $option, $wp_customize ) {
'theme_supports' => NULL,
'transport' => NULL,
'sanitize_callback' => 'wp_kses_post',
- 'sanitize_js_callback' => NULL
+ 'sanitize_js_callback' => NULL,
+ 'choices' => NULL
);
// Settings defaults
@@ -242,7 +278,8 @@ function customizer_library_add_setting( $option, $wp_customize ) {
'theme_supports' => $settings['theme_supports'],
'transport' => $settings['transport'],
'sanitize_callback' => $settings['sanitize_callback'],
- 'sanitize_js_callback' => $settings['sanitize_js_callback']
+ 'sanitize_js_callback' => $settings['sanitize_js_callback'],
+ 'choices' => $settings['choices']
)
);
@@ -259,7 +296,7 @@ function customizer_library_add_setting( $option, $wp_customize ) {
*/
function customizer_library_get_sanitization( $type ) {
- if ( 'select' == $type || 'radio' == $type ) {
+ if ( 'select' == $type || 'radio' == $type || 'radio-image' == $type ) {
return 'customizer_library_sanitize_choices';
}
@@ -275,7 +312,7 @@ function customizer_library_get_sanitization( $type ) {
return 'customizer_library_sanitize_file_url';
}
- if ( 'text' == $type || 'textarea' == $type ) {
+ if ( 'text' == $type || 'textarea' == $type || 'helptext' == $type ) {
return 'customizer_library_sanitize_text';
}