开发者

I want to implement TinyMCE in my Wordpress plugin. HOW?

Basically need the default Wordpress TinyMCE WYSIWYG editor where the user will enter some formatted text in my plugin. How do I integrate/implement TinyMCE in a simple HTML Wordpress form??

I'm using Wordp开发者_开发技巧ress v2.9!


The function you are looking for is wp_tiny_mce. Here is how to include the editor in one of your plugin’s admin panel.

  1. Include this code in the admin_head hook

    add_filter('admin_head','zd_multilang_tinymce');
    
    function zd_multilang_tinymce() {
        wp_admin_css('thickbox');
        wp_print_scripts('jquery-ui-core');
        wp_print_scripts('jquery-ui-tabs');
        wp_print_scripts('post');
        wp_print_scripts('editor');
        add_thickbox();
        wp_print_scripts('media-upload');
        if (function_exists('wp_tiny_mce')) wp_tiny_mce();
        // use the if condition because this function doesn't exist in version prior to 2.7
    }
    
  2. Call the editor anywhere you need it to be displayed

    the_editor($content_to_load);
    

Source

0

上一篇:

下一篇:

精彩评论

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

最新问答

问答排行榜