Jump to content

peter_b

New Members
  • Posts

    1
  • Joined

  • Last visited

peter_b's Achievements

Newbie

Newbie (1/5)

0

Reputation

  1. 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
×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.