comments.php 1.9 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980
  1. <?php declare( strict_types = 1 ); ?>
  2. <?php
  3. /**
  4. * The template for displaying comments
  5. *
  6. * This is the template that displays the area of the page that contains both the current comments
  7. * and the comment form.
  8. *
  9. * @link https://developer.wordpress.org/themes/basics/template-hierarchy/
  10. *
  11. * @package Seedlet
  12. */
  13. /*
  14. * If the current post is protected by a password and
  15. * the visitor has not yet entered the password we will
  16. * return early without loading the comments.
  17. */
  18. if ( post_password_required() ) {
  19. return;
  20. }
  21. ?>
  22. <div id="comments" class="comments-area default-max-width">
  23. <?php
  24. // You can start editing here -- including this comment!
  25. if ( have_comments() ) :
  26. ?>
  27. <h2 class="comments-title">
  28. <?php
  29. $seedlet_comment_count = get_comments_number();
  30. if ( '1' === $seedlet_comment_count ) {
  31. printf(
  32. /* translators: 1: title. */
  33. esc_html__( '1 Comment', 'seedlet' )
  34. );
  35. } else {
  36. printf( // WPCS: XSS OK.
  37. /* translators: 1: comment count number, 2: title. */
  38. esc_html( _nx( '%1$s Comment', '%1$s Comments', $seedlet_comment_count, 'comments title', 'seedlet' ) ),
  39. number_format_i18n( $seedlet_comment_count ),
  40. '<span>' . get_the_title() . '</span>'
  41. );
  42. }
  43. ?>
  44. </h2><!-- .comments-title -->
  45. <?php the_comments_navigation(); ?>
  46. <ol class="comment-list commentlist">
  47. <?php
  48. wp_list_comments( array(
  49. 'avatar_size'=> 42,
  50. 'style' => 'ol',
  51. 'short_ping' => true,
  52. 'format' => 'html'
  53. ) );
  54. ?>
  55. </ol><!-- .comment-list -->
  56. <?php
  57. the_comments_navigation();
  58. // If comments are closed and there are comments, let's leave a little note, shall we?
  59. if ( ! comments_open() ) :
  60. ?>
  61. <p class="no-comments"><?php esc_html_e( 'Comments are closed.', 'seedlet' ); ?></p>
  62. <?php
  63. endif;
  64. endif; // Check for have_comments().
  65. comment_form( array(
  66. 'logged_in_as' => null,
  67. 'title_reply' => esc_html__( 'Leave a Comment', 'seedlet')
  68. ) );
  69. ?>
  70. </div><!-- #comments -->