diff --git a/README.md b/README.md index 0a5b54f..2b47386 100755 --- a/README.md +++ b/README.md @@ -37,6 +37,7 @@ The Customizer Library currently supports these options: * Range * Textarea * Select (Typography) +* Richedit (TinyMCE) ### Sections @@ -254,6 +255,17 @@ $options['example-content'] = array( ); ~~~ +### Richedit + +~~~php +$options['example-richedit'] = array( + 'id' => 'example-richedit', + 'label' => __( 'Example richedit', 'textdomain' ), + 'section' => $section, + 'type' => 'richedit' +); +~~~ + ### Pass $options to Customizer Library After all the options and sections are defined, load them with the Customizer Library: diff --git a/custom-controls/richedit.php b/custom-controls/richedit.php new file mode 100644 index 0000000..8cbb303 --- /dev/null +++ b/custom-controls/richedit.php @@ -0,0 +1,68 @@ +value(); + ?> + + $option ) { + + if (!isset($option['id'])) { + $option['id'] = $id; + } + + if (!isset($option['type'])) { + $option['type'] = 'text'; + } // Set blank description if one isn't set if ( ! isset( $option['description'] ) ) { @@ -79,6 +87,7 @@ function customizer_library_register( $wp_customize ) { case 'checkbox': case 'range': case 'dropdown-pages': + case 'image_gallery': $wp_customize->add_control( $option['id'], $option @@ -167,6 +176,23 @@ function customizer_library_register( $wp_customize ) { ); break; + case 'richedit': + + $wp_customize->add_control( + new WP_Customize_Richedit_Control( + $wp_customize, $option['id'], $option + ) + ); + + break; + + } + + if (!empty($option['selector'])) { + $wp_customize->selective_refresh->add_partial( $option['id'], array( + 'selector' => $option['selector'], + 'container_inclusive' => isset($option['container_inclusive'])?$option['container_inclusive']:true, + ) ); } }