comments.php 1.9 KB

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