peter_b Posted January 3, 2016 Share Posted January 3, 2016 Hi, I hope someone can help me with this. It doesn't look like it should be too hard to do but I am not very good with php. I will show two code snippets below. The 1st one uses textarea and the second uses wp_editor. I would like to keep all the arguments etc of the first code but use wp_editor instead of the textarea. So basically combine the two scripts into one usable script. I hope that makes sense. Code snippet 1 (textarea): /* Post editor */ function userpro_post_editor($i, $class, $args) { if (!isset($args['require_content'])) {$args['require_content'] = 1;} // default for content: required ?> <div class="userpro-field userpro-field-editor" data-key="<?php echo $class; ?>"> <div class="userpro-input"> <?php if(isset($_GET['post_id'])) { $post = get_post($_GET['post_id']); $content=apply_filters(`the_content`, $post->post_content); }else $content=''; echo "<textarea data-custom-error='".__('Provide some content','userpro')."'data-required='".$args['require_content']."' name='$class-$i' id='$class-$i' placeholder='".__('Enter content here...','userpro')."'>".$content."</textarea>"; ?> </div> </div><div class="userpro-clear"></div> <?php } Code Snippet 2 (wp_editor): /* Post editor */ function userpro_post_editor($i, $class, $args) { ?> <div class="userpro-field userpro-field-editor" data-key="<?php echo $class; ?>"> <div class="userpro-input"> <?php $settings = array( 'wpautop' => true, 'media_buttons' => true, 'teeny' => true, 'quicktags' => true, 'editor_class' => $class, 'textarea_rows' => 10, 'tinymce' => array( 'content_css' => userpro_url . 'css/userpro-editor.css' ) ); $editor_id = $class; $content = ''; wp_editor( $content, $editor_id, $settings ); ?> </div> </div><div class="userpro-clear"></div> <?php } I appreciate anyone who can help and a big thank you in advance!! Peter Quote Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.