2010-03-04 49 views
3

基本上需要默认的Wordpress TinyMCE所见即所得的编辑器,用户将在我的插件中输入一些格式化的文本。如何在简单的HTML Wordpress格式中集成/实现TinyMCE我想在我的Wordpress插件中实现TinyMCE。怎么样?

我使用Wordpress v2.9!

+0

可能重复这样的代码: http://stackoverflow.com/questions/2855890/add-tinymce-to-wordpress-plugin – cregox 2011-03-12 21:54:30

回答

2

您正在寻找的功能是wp_tiny_mce。以下是如何在您的插件的管理面板中包含编辑器。

  1. 包括在admin_head

    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. 调用编辑器的任何地方,你需要用它来显示

    the_editor($content_to_load); 
    

Source

相关问题