comments.php 2.3 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667
  1. <?php
  2. /**
  3. * The template for displaying Comments
  4. *
  5. * The area of the page that contains comments and the comment form.
  6. *
  7. * @package WordPress
  8. * @subpackage Twenty_Fourteen
  9. * @since Twenty Fourteen 1.0
  10. */
  11. /*
  12. * If the current post is protected by a password and the visitor has not yet
  13. * entered the password we will 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 if ( have_comments() ) : ?>
  21. <h2 class="comments-title">
  22. <?php
  23. printf( _n( 'One thought on &ldquo;%2$s&rdquo;', '%1$s thoughts on &ldquo;%2$s&rdquo;', get_comments_number(), 'twentyfourteen' ),
  24. number_format_i18n( get_comments_number() ), get_the_title() );
  25. ?>
  26. </h2>
  27. <?php if ( get_comment_pages_count() > 1 && get_option( 'page_comments' ) ) : ?>
  28. <nav id="comment-nav-above" class="navigation comment-navigation" role="navigation">
  29. <h1 class="screen-reader-text"><?php _e( 'Comment navigation', 'twentyfourteen' ); ?></h1>
  30. <div class="nav-previous"><?php previous_comments_link( __( '&larr; Older Comments', 'twentyfourteen' ) ); ?></div>
  31. <div class="nav-next"><?php next_comments_link( __( 'Newer Comments &rarr;', 'twentyfourteen' ) ); ?></div>
  32. </nav><!-- #comment-nav-above -->
  33. <?php endif; // Check for comment navigation. ?>
  34. <ol class="comment-list">
  35. <?php
  36. wp_list_comments( array(
  37. 'style' => 'ol',
  38. 'short_ping' => true,
  39. 'avatar_size'=> 34,
  40. ) );
  41. ?>
  42. </ol><!-- .comment-list -->
  43. <?php if ( get_comment_pages_count() > 1 && get_option( 'page_comments' ) ) : ?>
  44. <nav id="comment-nav-below" class="navigation comment-navigation" role="navigation">
  45. <h1 class="screen-reader-text"><?php _e( 'Comment navigation', 'twentyfourteen' ); ?></h1>
  46. <div class="nav-previous"><?php previous_comments_link( __( '&larr; Older Comments', 'twentyfourteen' ) ); ?></div>
  47. <div class="nav-next"><?php next_comments_link( __( 'Newer Comments &rarr;', 'twentyfourteen' ) ); ?></div>
  48. </nav><!-- #comment-nav-below -->
  49. <?php endif; // Check for comment navigation. ?>
  50. <?php if ( ! comments_open() ) : ?>
  51. <p class="no-comments"><?php _e( 'Comments are closed.', 'twentyfourteen' ); ?></p>
  52. <?php endif; ?>
  53. <?php endif; // have_comments() ?>
  54. <?php comment_form(); ?>
  55. </div><!-- #comments -->