Skip to content

Instantly share code, notes, and snippets.

Embed
What would you like to do?
Implementación del editor de texto como control para el Customizer de Wordpress
<?php
class WP_Customize_Editor extends WP_Customize_Control {
public $type = 'editor';
public function render_content() { ?>
<label>
<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() ); ?>">
<?php
$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 );
do_action('admin_footer');
do_action('admin_print_footer_scripts');
?>
</label>
<?php
}
}
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.