• Hi,
    I have a issue. I can’t show comment box. when I call comments_template() to show comments, My site is loading the connection reset bug. I try to g remove comment_form function or active other themes then the issue disappears. Anyone ever have a same problem can help me.
    Thanks !

Viewing 2 replies - 1 through 2 (of 2 total)
  • Can you please post the contents of comments.php so that, we can determine the exact problem.

    because my guess is that when you are loading comments_template, it loads all the comments of the sites instead of per post vice.

    Thread Starter thanhhiep992

    (@thanhhiep992)

    Thanks Ritesh Sanap
    Here:

    <div class="blog-comment">
    <?php
    // Do not delete these lines
    if (!empty($_SERVER['SCRIPT_FILENAME']) && 'comments.php' == basename($_SERVER['SCRIPT_FILENAME']))
        die ('Please do not load this page directly. Thanks!');
    
    if ( post_password_required() ) { ?>
        <div class="alert alert-info"><?php _e("This post is password protected. Enter the password to view comments.",LANGUAGE); ?></div>
        <?php
        return;
    }
    ?>
    
    <!-- You can start editing here. -->
    
    <?php if ( have_comments() ) : ?>
    
        <?php if ( ! empty($comments_by_type['comment']) ) : ?>
        <h2 class="title-right-blog"><?php comments_number(__("Comment",LANGUAGE) .' <span>' . __("(0)",LANGUAGE) . '</span> ', __("Comment",LANGUAGE) .' <span>' . __("(1)",LANGUAGE) . '</span> ', __("Comment",LANGUAGE) .' <span>(%)</span> ' );?></h2>
    
            <ul class="commentlist clear">
                <?php wp_list_comments('type=comment&callback=wp_comments'); ?>
    
        <?php endif; ?>
    
        <?php if ( ! empty($comments_by_type['pings']) ) : ?>
            <h6 id="pings">Trackbacks/Pingbacks</h6>
    
            <ul class="pinglist">
                <?php wp_list_comments('type=pings&callback=list_pings'); ?>
    
        <?php endif; ?>
    
        <nav id="comment-nav">
            <ul class="pagination">
    
    <li><?php previous_comments_link( __("Older comments",LANGUAGE) ) ?></li>
    <li><?php next_comments_link( __("Newer comments",LANGUAGE) ) ?></li>
        </nav>
    <?php else : // this is displayed if there are no comments so far ?>
    
        <?php if ( comments_open() ) : ?>
            <!-- If comments are open, but there are no comments. -->
    
        <?php else : // comments are closed
            ?>
    
            <!-- If comments are closed. -->
            <p class="alert alert-info"><?php _e("Comments are closed",LANGUAGE); ?>.</p>
    
        <?php endif; ?>
    
    <?php endif; ?>
    
    <?php if ( comments_open() ) : ?>
    
        <?php
        $commenter = wp_get_current_commenter();
        $req = get_option( 'require_name_email' );
        $aria_req = ( $req ? " aria-required='true'" : '' );
        $defaults = array(
            'fields' => apply_filters( 'comment_form_default_fields', array(
    
                    'author' =>'<div class="comment-form-author control-group col-sm-4"><input id="author" name="author" type="text" value="' . esc_attr( $commenter['comment_author'] ) .'" ' . $aria_req . ' placeholder="'.__( 'Name', LANGUAGE ).'" /></div>',
    
                    'email' =>'<div class="comment-form-email control-group col-sm-4"><input id="email" name="email" type="text" value="' . esc_attr(  $commenter['comment_author_email'] ) .'" ' . $aria_req . ' placeholder="'.__( 'Email', LANGUAGE ).'" /></div>',
    
                    'url' =>'<div class="comment-form-url control-group col-sm-4"><div class="controls"><input id="url" name="url" type="text" value="' . esc_attr( $commenter['comment_author_url'] ) .'" placeholder="'.__( 'Website', LANGUAGE ).'"/></div></div>'
                )
            ),
            'comment_field' =>  '<div class="clear"></div><div class="comment-form-comment control-group col-xs-12"><div class="controls"><textarea id="comment" name="comment" cols="45" rows="8" aria-required="true" placeholder="Your comment here.."></textarea></div></div>',
            'must_log_in' => '<div class="must-log-in control-group"><div class="controls">' .sprintf(__( 'You must be <a href="%s">logged in</a> to post a comment.' ),wp_login_url( apply_filters( 'the_permalink', get_permalink() ) )) . '</div></div >',
            'logged_in_as' => '<div class="logged-in-as control-group"><div class="controls">' .sprintf(__( 'Logged in as <a href="%1$s">%2$s</a>. <a href="%3$s" title="Log out of this account">Log out?</a>' ),admin_url( 'profile.php' ),$user_identity,wp_logout_url( apply_filters( 'the_permalink', get_permalink( ) ) )) . '</div></div>',
    
            'comment_notes_before' => '<div class="comment-notes control-group"><div class="controls">' .__( 'Your email address will not be published.' ) .'</div></div>',
    
            'comment_notes_after' => '<div class="form-allowed-tags control-group"><div class="controls">' .sprintf( __( 'You may use these <abbr title="HyperText Markup Language">HTML</abbr> tags and attributes: %s' ),' <code>' . allowed_tags() . '</code>') . '</div></div>',
    
            'id_form'              => 'commentform',
    
            'id_submit'            => 'submit',
    
            'title_reply'          => __( 'Leave a Comment',LANGUAGE ),
    
            'title_reply_to'       => __( 'Leave a Reply %s',LANGUAGE ),
    
            'cancel_reply_link'    => __( 'Cancel reply',LANGUAGE ),
    
            'label_submit'         => __( 'Post Comment',LANGUAGE ),
    
        );?>
    
        <div class="row">
            <?php comment_form($defaults);?>
        </div>
    
    <?php endif; // if you delete this the sky will fall on your head ?>
    
    </div>

Viewing 2 replies - 1 through 2 (of 2 total)
  • The topic ‘The connection was reset’ is closed to new replies.