如何在自定义插件中使用Wordpress文本编辑器

时间:2010-11-10 04:44:24

标签: wordpress plugins

我们如何为我的wordpress插件使用默认的wordpress文本编辑器。有什么建议吗?

4 个答案:

答案 0 :(得分:8)

WordPress文本编辑器是TinyMCE Editor的应用程序。根据{{​​3}},您可以利用位于wp_includes / js / tinymce中的文件并自行创建编辑器实例。

查看这些文章以获取示例说明:
the documentation

http://www.keighl.com/2010/01/tinymce-in-wordpress-plugins/

答案 1 :(得分:5)

自Wordpress 3.3起the_editor已弃用wp_editor。 wp_editor使用新的媒体上传器,并在此处利用Wordpress 3.5.x文档的所有新功能:http://codex.wordpress.org/Function_Reference/wp_editor

如何使用它的一个很好的例子可以在Wptuts +这里找到:http://wp.tutsplus.com/articles/tips-articles/quick-tip-using-wp_editor/

答案 2 :(得分:1)

非常容易尝试此代码 工作正常

 wp_editor( $distribution, 'distribution', array( 'theme_advanced_buttons1' => 'bold, italic, ul, pH, pH_min', "media_buttons" => true, "textarea_rows" => 8, "tabindex" => 4 ) );

答案 3 :(得分:0)

非常简单:

<?php wp_editor( $content, $editor_id ); ?> 

这会生成很多html标签。但您感兴趣的是textarea,其名称设置为$ editor_id。因此,在提交表单时,您可以保存该内容。

您可以在此处找到更多信息:https://codex.wordpress.org/Function_Reference/wp_editor