首页
学习
活动
专区
圈层
工具
发布
社区首页 >问答首页 >幻灯片字段- wp_editor而不是textfield

幻灯片字段- wp_editor而不是textfield
EN

Stack Overflow用户
提问于 2014-12-29 02:45:13
回答 1查看 1.2K关注 0票数 2

我正在尝试自定义幻灯片默认字段(幻灯片字段- Redux框架),以便包含wp编辑器,而不是文本区域(描述区域)

原始文件在这里:slides.php

到目前为止,我已经更改了代码的这一部分。

代码语言:javascript
复制
if ( $this->field[ 'show' ][ 'description' ] ) {
$placeholder = ( isset ( $this->field[ 'placeholder' ][ 'description' ] ) ) ? esc_attr ($this->field[ 'placeholder' ][ 'description' ] ) : __ ( 'Description', 'redux-framework' );
echo '<li><textarea name="' . $this->field[ 'name' ] . '[' . $x . '][description]' .   $this->field['name_suffix'] . '" id="' . $this->field[ 'id' ] . '-description_' . $x . '" placeholder="' . $placeholder . '" class="large-text" rows="6">' . esc_attr ( $slide[ 'description' ] ) . '</textarea></li>';
}

对此:

代码语言:javascript
复制
if ( $this->field[ 'show' ][ 'description' ] ) {
$placeholder = ( isset ( $this->field[ 'placeholder' ][ 'description' ] ) ) ? esc_attr ( $this->field[ 'placeholder' ][ 'description' ] ) : __ ( 'Description', 'redux-framework' );
$editor_id =  $this->field[ 'id' ] . '-description_' . $x;

echo '<li> '.wp_editor( $content, $editor_id ,array("textarea_name" => ''.$this->field[ 'name' ] . '[' . $x . '][description]' . $this->field['name_suffix'].'' ));'</li>';
}

所以,我在幻灯片中得到了wp_editors,但问题是,我无法保存任何内容,BTW每个动态生成的编辑器文本字段都有唯一的名称和id,就像原始代码中的一样。

更新

请注意,编辑器在页面刷新后不保留内容,而是在第一次提交时存储数据。

EN

回答 1

Stack Overflow用户

发布于 2014-12-29 03:10:16

请参阅:编辑器

wp_editor采用三个参数。你的代码中显示了四个。我很惊讶这没有回击错误或警告。

所以,改变这个

代码语言:javascript
复制
echo '<li> '.wp_editor( $content, $editor_id, '',array("textarea_name" => ''.$this->field[ 'name' ] . '[' . $x . '][description]' . $this->field['name_suffix'].'' ));'</li>';

}

到这个

代码语言:javascript
复制
echo '<li> '.wp_editor( $content, $editor_id, array("textarea_name" => ''.$this->field[ 'name' ] . '[' . $x . '][description]' . $this->field['name_suffix'].'' ));'</li>';

}

票数 4
EN
页面原文内容由Stack Overflow提供。腾讯云小微IT领域专用引擎提供翻译支持
原文链接:

https://stackoverflow.com/questions/27682792

复制
相关文章

相似问题

领券
问题归档专栏文章快讯文章归档关键词归档开发者手册归档开发者手册 Section 归档