jeudi 21 avril 2016

How to add wp_editor in custom widget

I an trying to create a image widget with wp editor. I see the editor but i cant the text like make it bold or bigger nither i see the tab switch from visual to text. Following is my code: Thanks in advance.

<input type="hidden" id="<?php echo esc_attr($this->get_field_id('description')); ?>" name="<?php echo esc_attr($this->get_field_name('description')); ?>" value="<?php echo esc_attr($instance['description']); ?>" />
        <?php  
            $edi_name =  esc_attr($this->get_field_name('description'));
            $content = $instance['description'];
            $editor_id_new = esc_attr($this->get_field_id('description'));
            $settings = array( 'media_buttons' => false,
              'textarea_rows' => 6,
              'textarea_name' => $edi_name,
              'teeny'         => false, 
              'menubar'     => false,
              'default_editor'   => 'tinymce',
              'quicktags' => false
              );  
            wp_editor( $content, $editor_id_new, $settings );
        ?>
        <script>
        (function($){
            tinyMCE.execCommand('mceAddEditor', false, '<?php echo $this->get_field_id('description'); ?>');
        })(jQuery);
        </script>



via Chebli Mohamed

Aucun commentaire:

Enregistrer un commentaire