我正在尝试自定义幻灯片默认字段(幻灯片字段- Redux框架),以便包含wp编辑器,而不是文本区域(描述区域)
原始文件在这里:slides.php
到目前为止,我已经更改了代码的这一部分。
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>';
}对此:
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,就像原始代码中的一样。
更新
请注意,编辑器在页面刷新后不保留内容,而是在第一次提交时存储数据。
发布于 2014-12-29 03:10:16
请参阅:编辑器
wp_editor采用三个参数。你的代码中显示了四个。我很惊讶这没有回击错误或警告。
所以,改变这个
echo '<li> '.wp_editor( $content, $editor_id, '',array("textarea_name" => ''.$this->field[ 'name' ] . '[' . $x . '][description]' . $this->field['name_suffix'].'' ));'</li>';}
到这个
echo '<li> '.wp_editor( $content, $editor_id, array("textarea_name" => ''.$this->field[ 'name' ] . '[' . $x . '][description]' . $this->field['name_suffix'].'' ));'</li>';}
https://stackoverflow.com/questions/27682792
复制相似问题