Redux Framework slides field – wp_editor instead of textfield

I’m trying to customize slides default field (slides field – Redux framework) in order to include wp editor instead of textarea (description area)

original file is here : https://raw.githubusercontent.com/ReduxFramework/redux-framework/master/ReduxCore/inc/fields/slides/field_slides.php

Read More

So far I have changed this part of the code

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

to this:

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

so, I’m getting wp_editors inside slides, but the problem is, I can not save any content,
BTW each dynamically generated editor text field has unique name and id, like in the original code.

UPDATE

just notice that editor doesn’t keep the content after page refresh, but stores the data on the first submit.

Related posts

Leave a Reply

1 comment

  1. See: http://codex.wordpress.org/Function_Reference/wp_editor

    wp_editor takes three parameters. You have four showing in your code. I’m surprised this did not kick back an error or warning.

    So, change this

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

    }

    to this

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

    }