comments.php 3.6 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101
  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://codex.wordpress.org/Template_Hierarchy
  9. *
  10. * @package Radcliffe 2
  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">
  22. <?php
  23. // You can start editing here -- including this comment!
  24. if ( have_comments() ) : ?>
  25. <div class="comments-wrapper">
  26. <h2 class="comments-title">
  27. <?php
  28. $comment_count = get_comments_number();
  29. if ( 1 === $comment_count ) {
  30. printf(
  31. /* translators: 1: title. */
  32. esc_html_e( 'One thought on &ldquo;%1$s&rdquo;', 'radcliffe-2' ),
  33. '<span>' . get_the_title() . '</span>'
  34. );
  35. } else {
  36. printf( // WPCS: XSS OK.
  37. /* translators: 1: comment count number, 2: title. */
  38. esc_html( _nx( '%1$s thought on &ldquo;%2$s&rdquo;', '%1$s thoughts on &ldquo;%2$s&rdquo;', $comment_count, 'comments title', 'radcliffe-2' ) ),
  39. number_format_i18n( $comment_count ),
  40. '<span>' . get_the_title() . '</span>'
  41. );
  42. }
  43. ?>
  44. </h2><!-- .comments-title -->
  45. <?php if ( get_comment_pages_count() > 1 && get_option( 'page_comments' ) ) : // Are there comments to navigate through? ?>
  46. <nav id="comment-nav-above" class="navigation comment-navigation">
  47. <h2 class="screen-reader-text"><?php esc_html_e( 'Comment navigation', 'radcliffe-2' ); ?></h2>
  48. <div class="nav-links">
  49. <div class="nav-previous"><?php previous_comments_link( radcliffe_2_get_svg( array( 'icon' => 'previous' ) ) . esc_html__( 'Older Comments', 'radcliffe-2' ) ); ?></div>
  50. <div class="nav-next"><?php next_comments_link( esc_html__( 'Newer Comments', 'radcliffe-2' ). radcliffe_2_get_svg( array( 'icon' => 'next' ) ) ); ?></div>
  51. </div><!-- .nav-links -->
  52. </nav><!-- #comment-nav-above -->
  53. <?php endif; // Check for comment navigation. ?>
  54. <ol class="comment-list">
  55. <?php
  56. wp_list_comments( array(
  57. 'style' => 'ol',
  58. 'short_ping' => true,
  59. 'callback' => 'radcliffe_2_comment',
  60. ) );
  61. ?>
  62. </ol><!-- .comment-list -->
  63. <?php if ( get_comment_pages_count() > 1 && get_option( 'page_comments' ) ) : // Are there comments to navigate through? ?>
  64. <nav id="comment-nav-below" class="navigation comment-navigation">
  65. <h2 class="screen-reader-text"><?php esc_html_e( 'Comment navigation', 'radcliffe-2' ); ?></h2>
  66. <div class="nav-links">
  67. <div class="nav-previous"><?php previous_comments_link( radcliffe_2_get_svg( array( 'icon' => 'previous' ) ) . esc_html__( 'Older Comments', 'radcliffe-2' ) ); ?></div>
  68. <div class="nav-next"><?php next_comments_link( esc_html__( 'Newer Comments', 'radcliffe-2' ). radcliffe_2_get_svg( array( 'icon' => 'next' ) ) ); ?></div>
  69. </div><!-- .nav-links -->
  70. </nav><!-- #comment-nav-below -->
  71. <?php
  72. endif; // Check for comment navigation.
  73. ?>
  74. </div><!-- .comments-wrapper -->
  75. <?php
  76. endif; // Check for have_comments().
  77. ?>
  78. <div class="respond">
  79. <div class="respond-wrapper">
  80. <?php
  81. // If comments are closed and there are comments, let's leave a little note, shall we?
  82. if ( ! comments_open() && get_comments_number() && post_type_supports( get_post_type(), 'comments' ) ) : ?>
  83. <p class="no-comments"><?php esc_html_e( 'Comments are closed.', 'radcliffe-2' ); ?></p>
  84. <?php endif; ?>
  85. <?php comment_form(); ?>
  86. </div>
  87. </div>
  88. </div><!-- #comments -->