comments.php 3.4 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102
  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 Scratchpad
  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. <h2 class="comments-title">
  26. <?php
  27. printf( // WPCS: XSS OK.
  28. esc_html( _nx( 'One thought on &ldquo;%2$s&rdquo;', '%1$s thoughts on &ldquo;%2$s&rdquo;', get_comments_number(), 'comments title', 'scratchpad' ) ),
  29. number_format_i18n( get_comments_number() ),
  30. '<span>' . get_the_title() . '</span>'
  31. );
  32. ?>
  33. </h2>
  34. <?php if ( get_comment_pages_count() > 1 && get_option( 'page_comments' ) ) : // Are there comments to navigate through? ?>
  35. <nav id="comment-nav-above" class="navigation comment-navigation" role="navigation">
  36. <h2 class="screen-reader-text"><?php esc_html_e( 'Comment navigation', 'scratchpad' ); ?></h2>
  37. <div class="nav-links">
  38. <div class="nav-previous"><?php previous_comments_link( esc_html__( 'Older Comments', 'scratchpad' ) ); ?></div>
  39. <div class="nav-next"><?php next_comments_link( esc_html__( 'Newer Comments', 'scratchpad' ) ); ?></div>
  40. </div><!-- .nav-links -->
  41. </nav><!-- #comment-nav-above -->
  42. <?php endif; // Check for comment navigation. ?>
  43. <ol class="comment-list">
  44. <?php
  45. wp_list_comments( array(
  46. 'style' => 'ol',
  47. 'short_ping' => true,
  48. 'avatar_size' => 100,
  49. ) );
  50. ?>
  51. </ol><!-- .comment-list -->
  52. <?php if ( get_comment_pages_count() > 1 && get_option( 'page_comments' ) ) : // Are there comments to navigate through? ?>
  53. <nav id="comment-nav-below" class="navigation comment-navigation" role="navigation">
  54. <h2 class="screen-reader-text"><?php esc_html_e( 'Comment navigation', 'scratchpad' ); ?></h2>
  55. <div class="nav-links">
  56. <div class="nav-previous"><?php previous_comments_link( esc_html__( 'Older Comments', 'scratchpad' ) ); ?></div>
  57. <div class="nav-next"><?php next_comments_link( esc_html__( 'Newer Comments', 'scratchpad' ) ); ?></div>
  58. </div><!-- .nav-links -->
  59. </nav><!-- #comment-nav-below -->
  60. <?php
  61. endif; // Check for comment navigation.
  62. endif; // Check for have_comments().
  63. // If comments are closed and there are comments, let's leave a little note, shall we?
  64. if ( ! comments_open() && get_comments_number() && post_type_supports( get_post_type(), 'comments' ) ) : ?>
  65. <p class="no-comments"><?php esc_html_e( 'Comments are closed.', 'scratchpad' ); ?></p>
  66. <?php
  67. endif;
  68. ?>
  69. </div><!-- #comments -->
  70. <?php if ( comments_open() && have_comments() ) : ?>
  71. <div class="pencil-shaving-contain">
  72. <?php get_template_part( 'images/inline', 'pencil-shaving.svg' ); ?>
  73. </div><!-- .pencil-shaving-contain -->
  74. <?php endif; ?>
  75. <?php if ( comments_open() ) : ?>
  76. <div id="comments-form">
  77. <div class="comments-form-contain">
  78. <?php
  79. get_template_part( 'images/inline', 'post-mark.svg' );
  80. get_template_part( 'images/inline', 'stamp.svg' );
  81. comment_form();
  82. ?>
  83. </div><!-- .comments-form-contain -->
  84. </div><!-- #comments-form -->
  85. <?php endif; ?>