Simplest way to add a second html editor to the post/page admin?

What’s the simplest way to add a second HTML editor to the post/page admin and show the content in a template?

What I need is something like a custom field that supports html, but I don’t need the options to name the field. And I don’t need a visual editor like tinyMCE; just html will do.

Read More

What I’m thinking of is simply a small text-editor box that sits under the main visual/html editor and shows the resulting html in a template via <?php if ( function_exists('my_extra_editor_content') ) ... with the text/html in a styleable div.

Plugins like http://wordpress.org/extend/plugins/custom-field-template/ and http://wordpress.org/extend/plugins/developers-custom-fields/ offer too much in terms of functions and choices.

Related posts

Leave a Reply

5 comments

  1. I dont know if this will help but any Custom Field input will support html. I use html there all the time for headings and custom text in posts and pages.

  2. For future travelers, the custom metaboxes are not a good idea for adding a second editor in pages. You should use wp_editor function inside the edit_page_form action so the form can be displayed. (You should use edit_form_advanced action for custom post types)

    Then you can use the save_post and get the value of the editor from $_POST object. Here’s an example:

    add_action( 'edit_page_form', 'se24801_add_second_editor' );
    function se24801_add_second_editor() {
        echo '<h2>Second Content </h2>'; 
        $content = get_post_meta( $post->ID, 'second_content', true );
        wp_editor(
            $content,
            'second_content',
            array(
                'media_buttons' =>  true,
            )
        );    
    } 
    
    add_action( 'save_post', 'se24801_save_second_content' );
    function se24801_save_second_content( $post_id ) {
        if(isset( $_POST['second_content'] ) ) {
            update_post_meta( $post_id, 'second_content', $_POST['second_content'] );
        }  
    }
    
  3. Have you tried a textarea in a meta box? Meta boxes are more user friendly.

    About your requirement, it sounds like just a textarea will do. Please be aware that even full tinyMce based editors are possible using existing WordPress libraries.

  4. Update from 2020. This is now extremely easily achievable with the Advanced Custom Fields plugin and using its provided function call the_field('field_ref') to insert in the page.