• own3mall

    (@own3mall)


    Hi All,

    I am using a plugin called Pods for WordPress along with the latest version of CKEditor for WordPress. I have created a custom post type and created a page template to display all custom posts. The template requests that each custom post display a comment form. When the template for the page is loaded, only the first custom post comment section gets initialized as CKEditor. The rest are blank textareas.

    Here’s a screenshot:

    Screenshot

    My template uses the following code:

    <p class="spTitle">New Deal</p>
    <p class="special">Presented By: <a href="{@company_url}" target="_blank">{@company_name}</a></p>
    
    <p><a href="{@company_url}" target="_blank"><img src="{@company_logo}" class="imgResize" /></a></p>
    <br>
    
    <?php
    $post_id = get_the_ID();
    
    $comment_array = get_approved_comments($post_id);
    
    $i = 0;
    foreach($comment_array as $comment){
        if($i == 0){
            echo "<h3>Comments</h3>";
        }
        $authorDate = date("n/d/Y h:i:s A", strtotime($comment->comment_date));
        echo "<p class=\"posted_comment_info\">Posted " .$authorDate. " by <span class=\"comment_author\">" .$comment->comment_author."</span></p>" . $comment->comment_content;
        $i++;
    }
    $args["comment_notes_after"] = "";
    $args["comment_field"] = '<p class="comment-form-comment"><label for="comment">' . _x( 'Comment', 'noun' ) .
        '</label><textarea id="comment" class="ckeditor" name="comment" cols="45" rows="8" aria-required="true">' .
        '</textarea></p>';
    comment_form( $args, $post_id ); 
    
    ?>
    <p class="date">Offer Posted:  {@offer_date}</p>
    <hr class="special" />

    As you can see, I assigned the ckeditor class to each comment textarea, but even that didn’t cause CKEditor to be initialized for these instances.

    So, is it possible to initialize multiple CKEditor instances for each comment form that is displayed on the page, and if so, how would I go about doing it?

    Any help is appreciated.

    http://wordpress.org/plugins/ckeditor-for-wordpress/

Viewing 7 replies - 1 through 7 (of 7 total)
  • Each ckeditor textarea likely needs to have a unique ID, maybe even field name if you have multiple textareas inside the same form element.

    Thread Starter own3mall

    (@own3mall)

    Each ckeditor instance would be in its own form. What’s strange is that if I include the ckeditor javascript files manually within my theme, each instance is initialized but has full controls because I don’t know how to specify that is use the WordPress configuration.

    So for some reason, even though each textarea is in its own field and has a class of ckeditor, only the first instance is initialized. Any idea why or where I can change this behavior?

    mitcheljh

    (@mitcheljh)

    I seem to be having the same problem.
    I’m trying to have two separate instances of ckeditor.
    Both are in different forms, and they have different ids and names.
    One of them is for comments, and the other for bbpress (I have them in separate tabs).

    Only one of the instances is being displayed.

    mitcheljh

    (@mitcheljh)

    I found something that works for me.
    First, I disable the standard (tinymce) editor for bbpress, with the following:

    function my_bbp_use_wp_editor()
    {
    	return false;
    }
    add_filter( 'bbp_use_wp_editor', 'my_bbp_enable_visual_editor' );

    Then, manually replace the bbpress editor with ckeditor.
    I did this at the bottom of ckeditor.config.js.

    CKEDITOR.replace('bbp_topic_content', ckeditorSettings.configuration);

    The bbpress editor replaces the bbpress editor, with the same toolbar configuration used in the comments.

    Thread Starter own3mall

    (@own3mall)

    Well, that didn’t work for me.

    I’ve tried everything, and I’m still at square one.

    Thread Starter own3mall

    (@own3mall)

    I added the following to the bottom of my ckeditor.config.js file:

    CKEDITOR.replace('lolzk', {
        toolbar: 'WordpressBasic' });

    I told WordPress to write the comment field using an ID of lolzk. It is replaced by CKEditor, but in its full toolbar state. It will not use the default WordPressBasic toolbar group. Any idea why that’s not working?

    If I use:

    CKEDITOR.replace('lolzk', ckeditorSettings.configuration);

    It gets replaced by a full CKEditor instance, not WordPressBasic or WordPressFull.

    Please help! I’d like it to get replaced with the WordPressBasic toolbar group.

    Thread Starter own3mall

    (@own3mall)

    Gave up on CKEditor, and I’m now using NicEditor for the comments. Here’s a guide that will walk you through it.

    You can have CKEditor installed too for posts, but just make sure you disable it for comments in the plugin settings:

    http://blog.eamster.tk/multiple-comment-forms-on-wordpress-page-using-wysiwyg-editor-nicedit/

Viewing 7 replies - 1 through 7 (of 7 total)
  • The topic ‘CKEditor with Multiple Comment Forms – Only First Instance Is Initialized’ is closed to new replies.