2010-03-04 46 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

相關問題