在WordPress插件中调用TinyMCE [英] Call TinyMCE in a WordPress plugin

查看:112
本文介绍了在WordPress插件中调用TinyMCE的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

有没有办法将TinyMCE添加到我自己的WordPress插件中?

Is there a way to add TinyMCE into my own WordPress plugin?

我的后端脚本中有一个textarea,并希望将此区域变成TinyMCE WYSIWYG可编辑的字段。有没有办法做到这一点?

I have a textarea in my back end script and want to make this area into a TinyMCE WYSIWYG editable field. Is there a way to do that?

此代码对我不起作用:

<?php
    wp_tiny_mce(false,array("editor_selector" => "test"));
?>
<textarea class="test" id="test" name="test"></textarea>

显示javascript错误

It shows the javascript error

f is undefined

Firebug截图:

Firebug screenshot:

这也不起作用:

<textarea class="theEditor" id="videogalerie-add_description" name="videogalerie-add_description"></textarea>


推荐答案

这在WordPress 3.3中更容易使用 wp_editor()功能。

This is much easier to do in WordPress 3.3 using the wp_editor() function.

I我正在开发一个将TinyMCE实例添加到主题选项页面的插件。这是它的样子:

I'm working on a plugin that will add a TinyMCE instance to a theme options page. Here's what it looks like:

// Add TinyMCE visual editor
wp_editor( $content, $id );

其中 $ content 是存储的内容, $ id 是该字段的名称。还可以传递选项以自定义TinyMCE功能,查看WordPress Codex以获取更多详细信息。

Where $content is the stored content and $id is the name of the field. Options can also be passed to customize the TinyMCE functionality, check out the WordPress Codex for more details.

这篇关于在WordPress插件中调用TinyMCE的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆