• Hi,
    I would like to add tinyMCE editor just like the default description area.
    I was succesfull in displaying them as esitors using wp_editors, but it just doesnt displays the content

    add_action( ‘edit_form_advanced’, ‘mytextarea’ );
    function mytextarea() {
    global $product;
    $content_features = get_post_meta( $product->ID, ‘wccaf_features’, true );
    wp_editor( $content_features, ‘features’ );
    }

Viewing 1 replies (of 1 total)
  • Thread Starter Piyush Rawat

    (@piyushrawat-1)

    Ok i’ve finally added tinyMCE in fields, and they’re being displayed as well. But they’re not formatting properly,<p> and <br> tags are not shown.
    Here’s the code i used.

    function admin_add_wysiwyg_custom_field_textarea()
    { ?>
    <script type=”text/javascript”>/* <![CDATA[ */
    jQuery(function($){
    var i=1;
    $(‘textarea#features, textarea#benefits ‘).each(function(e)
    {
    var id = $(this).attr(‘id’);
    if (!id)
    {
    id = ‘customEditor-‘ + i++;
    $(this).attr(‘id’,id);
    }
    tinyMCE.execCommand(“mceAddEditor”, false, id);
    tinyMCE.execCommand(‘mceAddControl’, false, id);
    });
    });
    /* ]]> */</script>
    <?php }
    add_action( ‘admin_print_footer_scripts’, ‘admin_add_wysiwyg_custom_field_textarea’, 99 );

Viewing 1 replies (of 1 total)
  • The topic ‘Use TinyMCE on textarea fields’ is closed to new replies.