comments.php 2.3 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677
  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 Shoreditch
  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. printf( // WPCS: XSS OK.
  29. esc_html( _nx( 'One thought on &ldquo;%2$s&rdquo;', '%1$s thoughts on &ldquo;%2$s&rdquo;', get_comments_number(), 'comments title', 'shoreditch' ) ),
  30. number_format_i18n( get_comments_number() ),
  31. '<span>' . get_the_title() . '</span>'
  32. );
  33. ?>
  34. </h2>
  35. <ol class="comment-list">
  36. <?php
  37. wp_list_comments( array(
  38. 'style' => 'ol',
  39. 'short_ping' => true,
  40. 'avatar_size' => 60,
  41. ) );
  42. ?>
  43. </ol><!-- .comment-list -->
  44. </div><!-- .comments-wrapper -->
  45. <?php if ( get_comment_pages_count() > 1 && get_option( 'page_comments' ) ) : // Are there comments to navigate through? ?>
  46. <nav id="comment-nav-below" class="navigation comment-navigation" role="navigation">
  47. <h2 class="screen-reader-text"><?php esc_html_e( 'Comment navigation', 'shoreditch' ); ?></h2>
  48. <div class="nav-links">
  49. <div class="nav-previous"><?php previous_comments_link( esc_html__( 'Older Comments', 'shoreditch' ) ); ?></div>
  50. <div class="nav-next"><?php next_comments_link( esc_html__( 'Newer Comments', 'shoreditch' ) ); ?></div>
  51. </div><!-- .nav-links -->
  52. </nav><!-- #comment-nav-below -->
  53. <?php
  54. endif; // Check for comment navigation.
  55. endif; // Check for have_comments().
  56. // If comments are closed and there are comments, let's leave a little note, shall we?
  57. if ( ! comments_open() && get_comments_number() && post_type_supports( get_post_type(), 'comments' ) ) : ?>
  58. <div class="comments-wrapper">
  59. <p class="no-comments"><?php esc_html_e( 'Comments are closed.', 'shoreditch' ); ?></p>
  60. </div><!-- .comments-wrapper -->
  61. <?php
  62. endif;
  63. comment_form();
  64. ?>
  65. </div><!-- #comments -->