【问题标题】:Activating Wordpress TinyMCE editor for a text area [closed]为文本区域激活 Wordpress TinyMCE 编辑器 [关闭]
【发布时间】:2012-09-10 01:42:05
【问题描述】:

我正在尝试为文本区域激活 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专家。谢谢,

【问题讨论】:

标签: php wordpress tinymce textarea


【解决方案1】:

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

这应该可行,但我目前无法从我所在的位置对其进行测试,请告诉我你的进展情况(但这应该让你走上正确的轨道)

【讨论】:

  • 嗨 Cub3,谢谢。它工作完美。只有一个问题,而不是显示 ---Original Message---- 前后有一个空格,即 \r\n\r\n\r\n--------Original Message---- ---- \r\n\r\n\r\n
  • 以下更新在 ---Original Message ---- <?php $content = '<br />--------Original消息-------- <br>' .$reply_message_contentmain; wp_editor($content, 'content-id', array('textarea_name' =&gt; 'txtmessage', 'media_buttons' =&gt; false, 'tinymce_adv' =&gt; array('width' =&gt; '300', 'theme_advanced_buttons1' =&gt; 'formatselect,forecolor,|,bold,italic,underline,|,bullist,numlist,blockquote,|,justifyleft,justifycenter,justifyright,justifyfull,|,link,unlink,|,spellchecker,wp_fullscreen,wp_adv' ) ); ?&gt; 代码&gt;。非常感谢 Cube3。
猜你喜欢
  • 1970-01-01
  • 2012-08-17
  • 1970-01-01
  • 1970-01-01
  • 2023-03-10
  • 1970-01-01
  • 2013-12-18
  • 1970-01-01
  • 1970-01-01
相关资源
最近更新 更多