0

I am using this tutorial to implent the wp_editor in comments. everything went fine except when i click on cancel-comment-reply-link. the form move on to its initial position on the bottom of commentlist without the textarea which is making impossible to write. i have to refrech the page to remake it appaear.

FYI: my theme uses Threaded Comments

<?php
add_filter( 'comment_form_defaults', 'custom_comment_form_defaults' );
function custom_comment_form_defaults( $args ) {
if ( is_user_logged_in() ) {
    $mce_plugins = 'inlinepopups, wordpress, wplink, wpdialogs';
} else {
    $mce_plugins = ' wordpress';
}
ob_start();

                                        $settings = array(

                                                        'media_buttons' => false,
                                                        'teeny' => true,
                                                        'quicktags' => false,

                                                        'textarea_rows' => '20',
                                                        'tinymce' => array(
                                                        'theme_advanced_buttons1' => ' fontsizeselect, forecolor,backcolor,|,bold,italic,underline,|,' .
                                                        'blockquote,|,justifyleft,justifycenter,justifyright,justifyfull ' .
                                                        ',|,link,unlink,|, image, undo, redo ' .
                                                        ',wp_advxxxxxxxxxx'
                                                            )
                                                        );
                                        wp_editor( '', 'comment', $settings );





$args['comment_field'] = ob_get_clean();
return $args;
}


add_action( 'wp_enqueue_scripts', '__inkness_child__scripts' );
function __inkness_child__scripts() {
wp_enqueue_script('jquery');
}

add_filter( 'comment_reply_link', '__inkness_child__comment_reply_link' );
function __inkness_child__comment_reply_link($link) {
return str_replace( 'onclick=', 'data-onclick=', $link );
}

add_action( 'wp_head', '__inkness_child__wp_head' );
function __inkness_child__wp_head() {
?>

<script type="text/javascript">
jQuery(function($){
    $('.comment-reply-link').click(function(e){
        e.preventDefault();
        var args = $(this).data('onclick');
        args = args.replace(/.*\(|\)/gi, '').replace(/\"|\s+/g, '');
        args = args.split(',');
        tinymce.EditorManager.execCommand('mceRemoveControl', true, 'comment');
        addComment.moveForm.apply( addComment, args );
        tinymce.EditorManager.execCommand('mceAddControl', true, 'comment');
    });





});
</script>



   <?php
   }

I am really confused about this problem please help. thnak you in advance.

  • Please do not bump your post. – Wyck Feb 1 '14 at 18:53
  • @Wyck sorry won't happen again – fritids Feb 1 '14 at 18:56

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.