Take the 2-minute tour ×
WordPress Development Stack Exchange is a question and answer site for WordPress developers and administrators. It's 100% free, no registration required.

I've been trying to set up the comments section of a site I am working on to use the default Wordpress WYSIWYG (TinyMCE). But it's harder than expected.

I used this tutorial to take me almost all the way there. The tutorial makes it so I can use the WYSIWYG as the comment form, and it even has a fix when you click on a comment reply link (so that it will work there too).

The problem occurs when you click on a comment reply link, then cancel. This causes the original WYSIWYG (the one that first loads at the bottom of the comment stream) to break.

I have no idea how to make this WYSIWYG work again. Any thoughts or ideas?

Any help is greatly appreciated!

share|improve this question
    
Try to hook into wp_footer instead of wp_head. Won't solve your problem, but makes sure other scripts are loaded before that. –  kaiser Sep 5 '12 at 13:19
    
Good question. I am trying to solve since i see i have same problem but i hope someone will find it before me :) –  Ünsal Korkmaz Mar 7 '13 at 12:30

2 Answers 2

I found solution. Basically you should remove all those additions from that tutorial and use "First solution for fixing comment-reply.js to support visual editors" section from http://www.techytalk.info/add-tinymce-quicktags-visual-editors-wordpress-comments-form/

I dont want copy-paste his solution here but we just creating a new comment-reply.js that supports wysiwyg

You can see live example with comments here: http://unsalkorkmaz.com/twitter-embeds-in-wrong-language/

share|improve this answer

Give this a shot:

<?php
/* Add WYSISYG editor to comment form. */
add_filter( 'comment_form_field_comment', 'wpse_64243_comment_editor' );

function wpse_64243_comment_editor( $field ) {

    if (!is_single()) return $field; //only on single post pages.
    global $post;

    ob_start();

    wp_editor( '', 'comment', array(
        'textarea_rows' => 15
    ) );

    $editor = ob_get_contents();

    ob_end_clean();

    //make sure comment media is attached to parent post

    $editor = str_replace( 'post_id=0', 'post_id='.get_the_ID(), $editor );

    return $editor;

}
share|improve this answer

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.