New Comment Template


Hello Everyone,

In Beans default comment template the comment reply opens in a new web page that's why I was adding a new comment template which opens the comment reply form in same page with js. After adding that template my theme speed went from 1.59s {with beans comments template} to 5.96s{my own comments template}. My php codes are not that heavy. So that's why i wanted to know does overriding a core file slows down the website..??


Hey Anupam,

It shouldn't slow down your website at all if it is done properly. Please share your code as there is probably something causing issues.

Thanks,


Hey thierry

Is there is a way to upload the file here..??



Thanks JC but there was a very few code so here it is.

<?php
/**
 * The template for displaying comments
 */
if ( post_password_required() ) {
  return;
}
?>

<div class="comment-box" id="comments">

 <?php if ( have_comments() ) : ?>
   <h4 class="comments-title">
     <?php
       printf( _nx( 'Comments on &ldquo;%2$s&rdquo;', '%1$s comments on &ldquo;%2$s&rdquo;', get_comments_number(), 'comments title', 'hyperindian' ),
         number_format_i18n( get_comments_number() ), get_the_title() );
     ?>
    </h4>

   <ol class="comments">
     <?php
       wp_list_comments( array(
          'style'       => 'li',
          'short_ping'  => true,
          'avatar_size' => 50,
          'per_page'    => '',
        ) );
      ?>
    </ol>

 <?php endif; // have_comments() ?>

  <?php
   if ( ! comments_open() && get_comments_number() && post_type_supports( get_post_type(), 'comments' ) ) :
  ?>
    <p class="no-comments"><?php _e( 'Comments are closed.', 'hyperindian' ); ?></p>
  <?php endif; ?>

 <?php comment_form(); ?>

</div>

here is the code thierry.


Thanks for sharing Anupam,

I have added a comments.php file to my starter child theme with the exact same snippet and I don't have any loading issue.

Have you added a comments.php file to your child theme too? If yes, then your issue must be somewhere else and I suggest that you proceed by elemination. Start with a blank starter child theme and add your comments overwrite first, then add the rest of your current child theme bit by bit until you get the loading issue so that you can identify which part is causing issues.

Good luck with it,

Write a reply

Login or register to write a reply, it's free!