1

In the first code below I would like to use wp_editor in lieu of the textarea. The second code snippet shows what I'm trying to use in the first code while keeping all the arguments etc in the first code snippet. I hope that makes sense.

Code Snippet 1:

/* 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
}

Second Code Snippet:

/* 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
}

Thank you for your help!! Pete

  • I was hoping someone might be able to help me with this? It doesn't look like it would be THAT hard to do? – Peter Jan 3 '16 at 0:33

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Browse other questions tagged or ask your own question.