2012-09-10 38 views
1

我正在尝试激活文本区域的TinyMCE。我的代码是低于为文本区域激活Wordpress 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专家。谢谢,

+0

http://tech-papers.org/wordpress -tinymce_editor/ –

回答

3

wp_editor()的语法是:

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

你已经离开$内容空白和编辑器调用后echo'ing ....所以这样做:

$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'))); 

这应该有效,但我无法从目前的位置进行测试,请告诉我您的行程(但这应该会让您走上正轨)

+0

Hi Cub3,谢谢。它工作完美。只有一个问题,而不是显示---原始消息----前后有一个空格,即\ r \ n \ r \ n \ r \ n --------原始消息---- ---- \ r \ n \ r \ n \ r \ n –

+1

更新以下插入换行符前后的换行符---原始消息---- --------Original Message--------
' .$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'))); ?>
。非常感谢Cube3。 –