comments.php 3.0 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677
  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. The actual display of comments is
  7. * handled by a callback to _s_comment() which is
  8. * located in the functions.php file.
  9. *
  10. * @package _s
  11. * @since _s 1.0
  12. */
  13. ?>
  14. <div id="comments" class="comments-area">
  15. <?php if ( post_password_required() ) : ?>
  16. <p class="nopassword"><?php _e( 'This post is password protected. Enter the password to view any comments.', '_s' ); ?></p>
  17. </div><!-- #comments .comments-area -->
  18. <?php
  19. /* Stop the rest of comments.php from being processed,
  20. * but don't kill the script entirely -- we still have
  21. * to fully load the template.
  22. */
  23. return;
  24. endif;
  25. ?>
  26. <?php // You can start editing here -- including this comment! ?>
  27. <?php if ( have_comments() ) : ?>
  28. <h2 class="comments-title">
  29. <?php
  30. printf( _n( 'One thought on &ldquo;%2$s&rdquo;', '%1$s thoughts on &ldquo;%2$s&rdquo;', get_comments_number(), '_s' ),
  31. number_format_i18n( get_comments_number() ), '<span>' . get_the_title() . '</span>' );
  32. ?>
  33. </h2>
  34. <?php if ( get_comment_pages_count() > 1 && get_option( 'page_comments' ) ) : // are there comments to navigate through ?>
  35. <nav role="navigation" id="comment-nav-above" class="site-navigation comment-navigation">
  36. <h1 class="assistive-text"><?php _e( 'Comment navigation', '_s' ); ?></h1>
  37. <div class="nav-previous"><?php previous_comments_link( __( '&larr; Older Comments', '_s' ) ); ?></div>
  38. <div class="nav-next"><?php next_comments_link( __( 'Newer Comments &rarr;', '_s' ) ); ?></div>
  39. </nav>
  40. <?php endif; // check for comment navigation ?>
  41. <ol class="commentlist">
  42. <?php
  43. /* Loop through and list the comments. Tell wp_list_comments()
  44. * to use _s_comment() to format the comments.
  45. * If you want to overload this in a child theme then you can
  46. * define _s_comment() and that will be used instead.
  47. * See _s_comment() in functions.php for more.
  48. */
  49. wp_list_comments( array( 'callback' => '_s_comment' ) );
  50. ?>
  51. </ol>
  52. <?php if ( get_comment_pages_count() > 1 && get_option( 'page_comments' ) ) : // are there comments to navigate through ?>
  53. <nav role="navigation" id="comment-nav-below" class="site-navigation comment-navigation">
  54. <h1 class="assistive-text"><?php _e( 'Comment navigation', '_s' ); ?></h1>
  55. <div class="nav-previous"><?php previous_comments_link( __( '&larr; Older Comments', '_s' ) ); ?></div>
  56. <div class="nav-next"><?php next_comments_link( __( 'Newer Comments &rarr;', '_s' ) ); ?></div>
  57. </nav>
  58. <?php endif; // check for comment navigation ?>
  59. <?php endif; // have_comments() ?>
  60. <?php
  61. // If comments are closed and there are no comments, let's leave a little note, shall we?
  62. if ( ! comments_open() && '0' != get_comments_number() && post_type_supports( get_post_type(), 'comments' ) ) :
  63. ?>
  64. <p class="nocomments"><?php _e( 'Comments are closed.', '_s' ); ?></p>
  65. <?php endif; ?>
  66. <?php comment_form(); ?>
  67. </div><!-- #comments .comments-area -->