comments.php 2.2 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869
  1. <?php
  2. /**
  3. * The template for displaying comments.
  4. *
  5. * The area of the page that contains both current comments
  6. * and the comment form.
  7. *
  8. * @package Publication
  9. */
  10. /*
  11. * If the current post is protected by a password and
  12. * the visitor has not yet entered the password we will
  13. * return early without loading the comments.
  14. */
  15. if ( post_password_required() ) {
  16. return;
  17. }
  18. ?>
  19. <div id="comments" class="comments-area">
  20. <?php // You can start editing here -- including this comment! ?>
  21. <?php if ( have_comments() ) : ?>
  22. <h2 class="comments-title">
  23. <?php
  24. printf( // WPCS: XSS OK.
  25. esc_html( _nx( 'One thought on &ldquo;%2$s&rdquo;', '%1$s thoughts on &ldquo;%2$s&rdquo;', get_comments_number(), 'comments title', 'publication' ) ),
  26. number_format_i18n( get_comments_number() ),
  27. '<span>' . get_the_title() . '</span>'
  28. );
  29. ?>
  30. </h2>
  31. <ol class="comment-list">
  32. <?php
  33. wp_list_comments( array(
  34. 'style' => 'ol',
  35. 'short_ping' => true,
  36. 'avatar_size' => 48,
  37. ) );
  38. ?>
  39. </ol><!-- .comment-list -->
  40. <?php if ( get_comment_pages_count() > 1 && get_option( 'page_comments' ) ) : // Are there comments to navigate through ?>
  41. <nav id="comment-nav-below" class="navigation comment-navigation" role="navigation">
  42. <h2 class="screen-reader-text"><?php esc_html_e( 'Comment navigation', 'publication' ); ?></h2>
  43. <div class="nav-links">
  44. <div class="nav-previous"><?php previous_comments_link( '<span class="meta-nav">' . esc_html__( 'Older Comments', 'publication' ) . '</span>' ); ?></div>
  45. <div class="nav-next"><?php next_comments_link( '<span class="meta-nav">' . esc_html__( 'Newer Comments', 'publication' ) . '</span>' ); ?></div>
  46. </div><!-- .nav-links -->
  47. </nav><!-- #comment-nav-below -->
  48. <?php endif; // Check for comment navigation. ?>
  49. <?php endif; // Check for have_comments(). ?>
  50. <?php
  51. // If comments are closed and there are comments, let's leave a little note, shall we?
  52. if ( ! comments_open() && '0' != get_comments_number() && post_type_supports( get_post_type(), 'comments' ) ) :
  53. ?>
  54. <p class="no-comments"><?php esc_html_e( 'Comments are closed.', 'publication' ); ?></p>
  55. <?php endif; ?>
  56. <?php comment_form(); ?>
  57. </div><!-- #comments -->