I'm trying to add a rich text editor to my own plugin. So I googled it first of course and I found several answers on dev4press and Stack Overflow. This code displays nothing so I tried another solution. This displays a rich text editor like :
This seems to work fine, but as soon I switch to the WYSIWYG tab the text I inserted is deleted, I only see a blank field and I can't type anything.
Is someone familiar with this problem? Is this a bug or what can I do to make it work?
These scripts and styles are included in my plugin:
function highlights_style() {
wp_enqueue_style('thickbox');
}
function highlights_script() {
wp_register_script( 'jquery.js', HIGHLIGHTS_PLUGIN_URL . 'jquery.js', array('jquery','media-upload','thickbox'));
wp_enqueue_script( 'jquery.js' );
wp_enqueue_script('media-upload');
wp_enqueue_script('thickbox');
wp_enqueue_script( 'editor' );
wp_enqueue_media();
add_action( 'admin_head', 'wp_tiny_mce' );
}
And I use this to display the editor:
the_editor( '' , 'content' );
wp_editor()
. See this example.