【发布时间】:2010-11-10 04:44:24
【问题描述】:
我们如何为我的 wordpress 插件使用默认的 wordpress 文本编辑器。请问有什么建议吗?
【问题讨论】:
我们如何为我的 wordpress 插件使用默认的 wordpress 文本编辑器。请问有什么建议吗?
【问题讨论】:
WordPress 文本编辑器是TinyMCE Editor 的应用程序。您可以使用位于 wp_includes/js/tinymce 中的文件并根据the documentation 自行创建编辑器的实例。
查看这篇文章以获取示例说明:
http://wordpress.org/support/topic/how-i-can-use-tinymce-for-my-own-plugin
【讨论】:
从 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/
【讨论】:
很容易试试这个代码 它正在工作
wp_editor( $distribution, 'distribution', array( 'theme_advanced_buttons1' => 'bold, italic, ul, pH, pH_min', "media_buttons" => true, "textarea_rows" => 8, "tabindex" => 4 ) );
【讨论】:
很简单:
<?php wp_editor( $content, $editor_id ); ?>
这会生成很多html标签。但您会感兴趣的是名称设置为 $editor_id 的 textarea。所以当表单提交时,你可以保存该内容。
您可以在这里找到更多信息:https://codex.wordpress.org/Function_Reference/wp_editor
【讨论】: