Redux 框架幻灯片字段 - wp_editor而不是文本字段


Redux Framework slides field - wp_editor instead of textfield

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

原始文件在这里 : https://raw.githubusercontent.com/ReduxFramework/redux-framework/master/ReduxCore/inc/fields/slides/field_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,但问题是,我无法保存任何内容,顺便说一句,每个动态生成的编辑器文本字段都有唯一的名称和 id,就像原始代码一样。

更新

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

参见:http://codex.wordpress.org/Function_Reference/wp_editor

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

}