TinyMCE in a div / textarea on frontend?

I have a post on my frontpage and I want to add the TinyMCE editor to it and could not make it work.

I’ve tried these guides without any luck

Read More

The guides are for making it work on backend.

I guess I need to find out how to do these things…

  1. Add some Javascript with wp_enqueue_script.
  2. Add some inline Javascript settings within script-tags.
  3. Add a textarea or a div with a specific name, class or ID.

Help me in any way, code, links to guides, advice, anything.

Related posts

Leave a Reply

1 comment

  1. What you’re looking for is two things:

    1. The wp_tiny_mce function that loads all the needed JS etc
    2. The code below:

    This to setup the JS etc:

    // Setup the TinyMCE stuff and target it at our desired textarea
    wp_tiny_mce( true, array( "editor_selector" => 'tinymce_class' ) );
    

    And this HTML where you need the editor box:

    <div class="editor_container">
        <textarea class="large-text tinymce_class" rows="5" id="tinymce_1" name="name">
            <?php echo esc_html($value) ?>
        </textarea>
    </div>