comments.php 2.5 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667
  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 spun_comment() which is
  8. * located in the functions.php file.
  9. *
  10. * @package Spun
  11. */
  12. ?>
  13. <?php
  14. /*
  15. * If the current post is protected by a password and
  16. * the visitor has not yet entered the password we will
  17. * return early without loading the comments.
  18. */
  19. if ( post_password_required() )
  20. return;
  21. ?>
  22. <div id="comments-toggle"></div>
  23. <div id="comments" class="comments-area">
  24. <?php // You can start editing here -- including this comment! ?>
  25. <?php if ( have_comments() ) : ?>
  26. <h2 class="comments-title">
  27. <?php
  28. printf( _n( 'One thought on &ldquo;%2$s&rdquo;', '%1$s thoughts on &ldquo;%2$s&rdquo;', get_comments_number(), 'spun' ),
  29. number_format_i18n( get_comments_number() ), '<span>' . get_the_title() . '</span>' );
  30. ?>
  31. </h2>
  32. <?php if ( get_comment_pages_count() > 1 && get_option( 'page_comments' ) ) : // are there comments to navigate through ?>
  33. <nav role="navigation" id="comment-nav-above" class="site-navigation comment-navigation">
  34. <h1 class="screen-reader-text"><?php _e( 'Comment navigation', 'spun' ); ?></h1>
  35. <div class="nav-previous"><?php previous_comments_link( _x( '<span class="screen-reader-text">&laquo;</span>', 'Previous Comments', 'spun' ) ); ?></div>
  36. <div class="nav-next"><?php next_comments_link( _x( '<span class="screen-reader-text">&raquo;</span>', 'Next Comments', 'spun' ) ); ?></div>
  37. </nav><!-- #comment-nav-before .site-navigation .comment-navigation -->
  38. <?php endif; // check for comment navigation ?>
  39. <ol class="commentlist">
  40. <?php
  41. /* Loop through and list the comments. Tell wp_list_comments()
  42. * to use spun_comment() to format the comments.
  43. * If you want to overload this in a child theme then you can
  44. * define spun_comment() and that will be used instead.
  45. * See spun_comment() in inc/template-tags.php for more.
  46. */
  47. wp_list_comments( array( 'callback' => 'spun_comment' ) );
  48. ?>
  49. </ol><!-- .commentlist -->
  50. <?php endif; // have_comments() ?>
  51. <?php
  52. // If comments are closed and there are comments, let's leave a little note, shall we?
  53. if ( ! comments_open() && '0' != get_comments_number() && post_type_supports( get_post_type(), 'comments' ) ) :
  54. ?>
  55. <p class="nocomments"><?php _e( 'Comments are closed.', 'spun' ); ?></p>
  56. <?php endif; ?>
  57. <?php comment_form( array( 'cancel_reply_link' => __( 'x', 'spun' ) ) ); ?>
  58. </div><!-- #comments .comments-area -->