comments.php 2.9 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273
  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 bml_comment() which is
  8. * located in the inc/template-tags.php file.
  9. *
  10. * @package bml
  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. <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( _nx( 'One thought on &ldquo;%2$s&rdquo;', '%1$s thoughts on &ldquo;%2$s&rdquo;', get_comments_number(), 'comments title', 'bml' ),
  26. number_format_i18n( get_comments_number() ), '<span>' . get_the_title() . '</span>' );
  27. ?>
  28. </h2>
  29. <?php if ( get_comment_pages_count() > 1 && get_option( 'page_comments' ) ) : // are there comments to navigate through ?>
  30. <nav id="comment-nav-above" class="comment-navigation" role="navigation">
  31. <h1 class="screen-reader-text"><?php _e( 'Comment navigation', 'bml' ); ?></h1>
  32. <div class="nav-previous"><?php previous_comments_link( __( '&larr; Older Comments', 'bml' ) ); ?></div>
  33. <div class="nav-next"><?php next_comments_link( __( 'Newer Comments &rarr;', 'bml' ) ); ?></div>
  34. </nav><!-- #comment-nav-above -->
  35. <?php endif; // check for comment navigation ?>
  36. <ol class="comment-list">
  37. <?php
  38. /* Loop through and list the comments. Tell wp_list_comments()
  39. * to use bml_comment() to format the comments.
  40. * If you want to override this in a child theme, then you can
  41. * define bml_comment() and that will be used instead.
  42. * See bml_comment() in inc/template-tags.php for more.
  43. */
  44. wp_list_comments( array( 'callback' => 'bml_comment' ) );
  45. ?>
  46. </ol><!-- .comment-list -->
  47. <?php if ( get_comment_pages_count() > 1 && get_option( 'page_comments' ) ) : // are there comments to navigate through ?>
  48. <nav id="comment-nav-below" class="comment-navigation" role="navigation">
  49. <h1 class="screen-reader-text"><?php _e( 'Comment navigation', 'bml' ); ?></h1>
  50. <div class="nav-previous"><?php previous_comments_link( __( '&larr; Older Comments', 'bml' ) ); ?></div>
  51. <div class="nav-next"><?php next_comments_link( __( 'Newer Comments &rarr;', 'bml' ) ); ?></div>
  52. </nav><!-- #comment-nav-below -->
  53. <?php endif; // check for comment navigation ?>
  54. <?php endif; // have_comments() ?>
  55. <?php
  56. // If comments are closed and there are comments, let's leave a little note, shall we?
  57. if ( ! comments_open() && '0' != get_comments_number() && post_type_supports( get_post_type(), 'comments' ) ) :
  58. ?>
  59. <p class="no-comments"><?php _e( 'Comments are closed.', 'bml' ); ?></p>
  60. <?php endif; ?>
  61. <?php comment_form(); ?>
  62. </div><!-- #comments -->