comments.php 2.5 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970
  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 Sketch
  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( _nx( 'One thought on &ldquo;%2$s&rdquo;', '%1$s thoughts on &ldquo;%2$s&rdquo;', get_comments_number(), 'comments title', 'sketch' ),
  25. number_format_i18n( get_comments_number() ), '<span>' . get_the_title() . '</span>' );
  26. ?>
  27. </h2>
  28. <?php if ( get_comment_pages_count() > 1 && get_option( 'page_comments' ) ) : // are there comments to navigate through ?>
  29. <nav id="comment-nav-above" class="comment-navigation" role="navigation">
  30. <h1 class="screen-reader-text"><?php _e( 'Comment navigation', 'sketch' ); ?></h1>
  31. <div class="nav-previous"><?php previous_comments_link( __( '< Older Comments', 'sketch' ) ); ?></div>
  32. <div class="nav-next"><?php next_comments_link( __( 'Newer Comments >', 'sketch' ) ); ?></div>
  33. </nav><!-- #comment-nav-above -->
  34. <?php endif; // check for comment navigation ?>
  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. <?php if ( get_comment_pages_count() > 1 && get_option( 'page_comments' ) ) : // are there comments to navigate through ?>
  45. <nav id="comment-nav-below" class="comment-navigation" role="navigation">
  46. <h1 class="screen-reader-text"><?php _e( 'Comment navigation', 'sketch' ); ?></h1>
  47. <div class="nav-previous"><?php previous_comments_link( __( '< Older Comments', 'sketch' ) ); ?></div>
  48. <div class="nav-next"><?php next_comments_link( __( 'Newer Comments >', 'sketch' ) ); ?></div>
  49. </nav><!-- #comment-nav-below -->
  50. <?php endif; // check for comment navigation ?>
  51. <?php endif; // have_comments() ?>
  52. <?php
  53. // If comments are closed and there are comments, let's leave a little note, shall we?
  54. if ( ! comments_open() && '0' != get_comments_number() && post_type_supports( get_post_type(), 'comments' ) ) :
  55. ?>
  56. <p class="no-comments"><?php _e( 'Comments are closed.', 'sketch' ); ?></p>
  57. <?php endif; ?>
  58. <?php comment_form(); ?>
  59. </div><!-- #comments -->