开发者

How to use wp-post editor in plugin

开发者 https://www.devze.com 2023-01-29 18:22 出处:网络
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 edit

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:

0

精彩评论

暂无评论...
验证码 换一张
取 消

关注公众号