Skip to content

Instantly share code, notes, and snippets.

What would you like to do?
Implementación del editor de texto como control para el Customizer de Wordpress
class WP_Customize_Editor extends WP_Customize_Control {
public $type = 'editor';
public function render_content() { ?>
<span class="customize-control-title"><?php echo esc_html( $this->label ); ?></span>
<input id="<?php echo $this->id; ?>-link" type="hidden" class="wp-editor-area" <?php $this->link(); ?> value="<?php echo esc_textarea( $this->value() ); ?>">
$settings = array(
'textarea_name' => $this->id,
'media_buttons' => true,
'tinymce' => array(
'setup' => "function (editor) {
var cb = function () {
var linkInput = document.getElementById('$this->id-link')
linkInput.value = editor.getContent()
linkInput.dispatchEvent(new Event('change'))
editor.on('Change', cb)
editor.on('Undo', cb)
editor.on('Redo', cb)
wp_editor($this->value(), $this->id, $settings );
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.