comments.php 2.9 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081
  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 Dyad
  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 class="comments-area-wrapper">
  20. <div id="comments" class="comments-area">
  21. <?php // You can start editing here -- including this comment! ?>
  22. <?php if ( have_comments() ) : ?>
  23. <h2 class="comments-title">
  24. <?php
  25. printf( // WPCS: XSS OK.
  26. esc_html( _nx( 'One Comment', '%1$s Comments', get_comments_number(), 'comments title', 'dyad-2' ) ),
  27. number_format_i18n( get_comments_number() )
  28. );
  29. ?>
  30. <?php if ( comments_open() ) { ?>
  31. <a href="#respond" class="add-comment-link"><?php esc_html_e( 'Add yours', 'dyad-2' ); ?></a>
  32. <?php } ?>
  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', 'dyad-2' ); ?></h2>
  37. <div class="nav-links">
  38. <div class="nav-previous"><?php previous_comments_link( esc_html__( 'Older Comments', 'dyad-2' ) ); ?></div>
  39. <div class="nav-next"><?php next_comments_link( esc_html__( 'Newer Comments', 'dyad-2' ) ); ?></div>
  40. </div><!-- .nav-links -->
  41. </nav><!-- #comment-nav-above -->
  42. <?php endif; // Check for comment navigation. ?>
  43. <ol class="comment-list">
  44. <?php wp_list_comments( array( 'avatar_size' => 100, 'style' => 'ol', 'short_ping' => true ) ); ?>
  45. </ol><!-- .comment-list -->
  46. <?php if ( get_comment_pages_count() > 1 && get_option( 'page_comments' ) ) : // Are there comments to navigate through? ?>
  47. <nav id="comment-nav-below" class="navigation comment-navigation" role="navigation">
  48. <h2 class="screen-reader-text"><?php esc_html_e( 'Comment navigation', 'dyad-2' ); ?></h2>
  49. <div class="nav-links">
  50. <div class="nav-previous"><?php previous_comments_link( esc_html__( 'Older Comments', 'dyad-2' ) ); ?></div>
  51. <div class="nav-next"><?php next_comments_link( esc_html__( 'Newer Comments', 'dyad-2' ) ); ?></div>
  52. </div><!-- .nav-links -->
  53. </nav><!-- #comment-nav-below -->
  54. <?php endif; // Check for comment navigation. ?>
  55. <?php endif; // Check for have_comments(). ?>
  56. <?php
  57. // If comments are closed and there are comments, let's leave a little note, shall we?
  58. if ( ! comments_open() && '0' != get_comments_number() && post_type_supports( get_post_type(), 'comments' ) ) :
  59. ?>
  60. <p class="no-comments"><?php esc_html_e( 'Comments are closed.', 'dyad-2' ); ?></p>
  61. <?php endif; ?>
  62. <?php comment_form(); ?>
  63. </div><!-- #comments -->
  64. </div><!-- .comments-area-wrapper -->