I want to use the post editor of wordpress in one of the plugins I'm developing. How am I su开发者_如何学JAVApposed to add the editor to the plugin.
Atlast I figured out a way to add the tiny-mce editor on my plugin.
You have to add a few script(s) and the post editor of wordpress will be available for you.
This is the code to use:
wp_enqueue_script( 'common' );
wp_enqueue_script( 'jquery-color' );
wp_enqueue_script('utils');
if (function_exists('add_thickbox')) add_thickbox();
wp_print_scripts('media-upload');
if (function_exists('wp_tiny_mce')) wp_tiny_mce();
wp_admin_css();
wp_print_scripts('editor');
do_action("admin_print_styles-post-php");
do_action('admin_print_styles');
It's enough to add the tiny mce editor on your plugin.
Now the following line is necessary to display the editor:
精彩评论