Нет описания

comments.php 2.6KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889909192939495
  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 WordPress
  11. * @subpackage Twenty_Twenty_One
  12. * @since Twenty Twenty-One 1.0
  13. */
  14. /*
  15. * If the current post is protected by a password and
  16. * the visitor has not yet entered the password,
  17. * return early without loading the comments.
  18. */
  19. if ( post_password_required() ) {
  20. return;
  21. }
  22. $twenty_twenty_one_comment_count = get_comments_number();
  23. ?>
  24. <div id="comments" class="comments-area default-max-width <?php echo get_option( 'show_avatars' ) ? 'show-avatars' : ''; ?>">
  25. <?php
  26. if ( have_comments() ) :
  27. ;
  28. ?>
  29. <h2 class="comments-title">
  30. <?php if ( '1' === $twenty_twenty_one_comment_count ) : ?>
  31. <?php esc_html_e( '1 comment', 'twentytwentyone' ); ?>
  32. <?php else : ?>
  33. <?php
  34. printf(
  35. /* translators: %s: Comment count number. */
  36. esc_html( _nx( '%s comment', '%s comments', $twenty_twenty_one_comment_count, 'Comments title', 'twentytwentyone' ) ),
  37. esc_html( number_format_i18n( $twenty_twenty_one_comment_count ) )
  38. );
  39. ?>
  40. <?php endif; ?>
  41. </h2><!-- .comments-title -->
  42. <ol class="comment-list">
  43. <?php
  44. wp_list_comments(
  45. array(
  46. 'avatar_size' => 60,
  47. 'style' => 'ol',
  48. 'short_ping' => true,
  49. )
  50. );
  51. ?>
  52. </ol><!-- .comment-list -->
  53. <?php
  54. the_comments_pagination(
  55. array(
  56. 'before_page_number' => esc_html__( 'Page', 'twentytwentyone' ) . ' ',
  57. 'mid_size' => 0,
  58. 'prev_text' => sprintf(
  59. '%s <span class="nav-prev-text">%s</span>',
  60. is_rtl() ? twenty_twenty_one_get_icon_svg( 'ui', 'arrow_right' ) : twenty_twenty_one_get_icon_svg( 'ui', 'arrow_left' ),
  61. esc_html__( 'Older comments', 'twentytwentyone' )
  62. ),
  63. 'next_text' => sprintf(
  64. '<span class="nav-next-text">%s</span> %s',
  65. esc_html__( 'Newer comments', 'twentytwentyone' ),
  66. is_rtl() ? twenty_twenty_one_get_icon_svg( 'ui', 'arrow_left' ) : twenty_twenty_one_get_icon_svg( 'ui', 'arrow_right' )
  67. ),
  68. )
  69. );
  70. ?>
  71. <?php if ( ! comments_open() ) : ?>
  72. <p class="no-comments"><?php esc_html_e( 'Comments are closed.', 'twentytwentyone' ); ?></p>
  73. <?php endif; ?>
  74. <?php endif; ?>
  75. <?php
  76. comment_form(
  77. array(
  78. 'logged_in_as' => null,
  79. 'title_reply' => esc_html__( 'Leave a comment', 'twentytwentyone' ),
  80. 'title_reply_before' => '<h2 id="reply-title" class="comment-reply-title">',
  81. 'title_reply_after' => '</h2>',
  82. )
  83. );
  84. ?>
  85. </div><!-- #comments -->