comments.php 1.4 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859
  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 WordPress
  9. * @subpackage Twenty_Fifteen
  10. * @since Twenty Fifteen 1.0
  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 if ( have_comments() ) : ?>
  23. <h2 class="comments-title">
  24. <?php
  25. printf( _nx( 'One thought on &ldquo;%2$s&rdquo;', '%1$s thoughts on &ldquo;%2$s&rdquo;', get_comments_number(), 'comments title', 'twentyfifteen' ),
  26. number_format_i18n( get_comments_number() ), get_the_title() );
  27. ?>
  28. </h2>
  29. <?php twentyfifteen_comment_nav(); ?>
  30. <ol class="comment-list">
  31. <?php
  32. wp_list_comments( array(
  33. 'style' => 'ol',
  34. 'short_ping' => true,
  35. 'avatar_size' => 56,
  36. ) );
  37. ?>
  38. </ol><!-- .comment-list -->
  39. <?php twentyfifteen_comment_nav(); ?>
  40. <?php endif; // have_comments() ?>
  41. <?php
  42. // If comments are closed and there are comments, let's leave a little note, shall we?
  43. if ( ! comments_open() && get_comments_number() && post_type_supports( get_post_type(), 'comments' ) ) :
  44. ?>
  45. <p class="no-comments"><?php _e( 'Comments are closed.', 'twentyfifteen' ); ?></p>
  46. <?php endif; ?>
  47. <?php comment_form(); ?>
  48. </div><!-- .comments-area -->