为文本区域激活Wordpress TinyMCE编辑器

时间:2012-09-10 01:42:06

标签: php wordpress tinymce textarea

我正在尝试为文本区域激活TinyMCE。我的代码在

之下
<?php
wp_editor( '', 'content-id', array( 'textarea_name' => 'txtmessage', 'media_buttons' => false, 'tinymce_adv' => array( 'width' => '300', 'theme_advanced_buttons1' => 'formatselect,forecolor,|,bold,italic,underline,|,bullist,numlist,blockquote,|,justifyleft,justifycenter,justifyright,justifyfull,|,link,unlink,|,spellchecker,wp_fullscreen,wp_adv' ) ) ); 
echo "\r\n";
echo "\r\n";
echo "\r\n --------Original Message-------- \r\n \r\n";
echo "\r\n\r\n".$reply_message_contentmain;

代码有效。但是,我的问题是回显消息显示在TinyMCE区域的底部和外部。任何建议,如何解决?我不是一个PHP专家。谢谢,

1 个答案:

答案 0 :(得分:3)

wp_editor()上的语法是:

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

您已将$ content留空并在编辑调用后回显....所以请执行以下操作:

$content = '\r\n\r\n\r\n--------Original Message-------- \r\n\r\n\r\n' .$reply_message_contentmain
wp_editor( $content, 'content-id', array( 'textarea_name' => 'txtmessage', 'media_buttons' => false, 'tinymce_adv' => array( 'width' => '300', 'theme_advanced_buttons1' => 'formatselect,forecolor,|,bold,italic,underline,|,bullist,numlist,blockquote,|,justifyleft,justifycenter,justifyright,justifyfull,|,link,unlink,|,spellchecker,wp_fullscreen,wp_adv' ) ) );

这应该有效,但是我无法从我现在的位置进行测试,让我知道你是怎么做的(但这应该让你走上正轨)