PageRenderTime 40ms CodeModel.GetById 14ms RepoModel.GetById 1ms app.codeStats 0ms

/wp-content/themes/best/comments.php

https://github.com/ActivateNY/activateny.org
PHP | 77 lines | 51 code | 8 blank | 18 comment | 8 complexity | 8a6db1537cc44393630c30a52412d629 MD5 | raw file
Possible License(s): GPL-2.0, AGPL-1.0, LGPL-2.1
  1. <?php
  2. /* =============================================================
  3. * comments.php
  4. * =============================================================
  5. * Template for Comments and Pingbacks
  6. * ============================================================= */
  7. ?>
  8. <div id="comments">
  9. <?php if ( post_password_required() ) : ?>
  10. <p class="nopassword hero-p"><?php echo 'This post is password protected.<br/>Please enter the password to view any comments.'; ?></p>
  11. </div><!-- #comments -->
  12. <?php
  13. /* Stop the rest of comments.php from being processed,
  14. * but don't kill the script entirely -- we still have
  15. * to fully load the template.
  16. */
  17. return;
  18. endif;
  19. ?>
  20. <?php if ( have_comments() ) : ?>
  21. <h3 id="comments-title">
  22. <?php
  23. printf( _n( 'One Response to &ldquo;%2$s&rdquo;', '%1$s Responses to &ldquo;%2$s&rdquo;', get_comments_number() ),
  24. number_format_i18n( get_comments_number() ), '<span>' . get_the_title() . '</span>' );
  25. ?>
  26. </h3>
  27. <?php if ( get_comment_pages_count() > 1 && get_option( 'page_comments' ) ) : // are there comments to navigate through ?>
  28. <nav id="comment-nav-above">
  29. <h1 class="visually-hidden"><?php echo 'comment navigation'; ?></h1>
  30. <div class="nav-previous"><?php previous_comments_link( '&larr; older comments' /* __() */ ); ?></div>
  31. <div class="nav-next"><?php next_comments_link( 'newer comments &rarr;' /* __() */ ); ?></div>
  32. </nav>
  33. <?php endif; // check for comment navigation ?>
  34. <ol class="commentlist">
  35. <?php
  36. /* Loop through and list the comments. Tell wp_list_comments()
  37. * to use respond_comment() to format the comments.
  38. * If you want to overload this in a child theme then you can
  39. * define respond_comment() and that will be used instead.
  40. * See respond_comment() in functions.php for more.
  41. */
  42. wp_list_comments( array( 'callback' => 'respond_comment' ) );
  43. ?>
  44. </ol>
  45. <?php if ( get_comment_pages_count() > 1 && get_option( 'page_comments' ) ) : // are there comments to navigate through ?>
  46. <nav id="comment-nav-below">
  47. <h1 class="visually-hidden"><?php echo 'comment navigation'; ?></h1>
  48. <div class="nav-previous"><?php previous_comments_link( '&larr; older comments' /* __() */ ); ?></div>
  49. <div class="nav-next"><?php next_comments_link( 'newer comments &rarr;' /* __() */ ); ?></div>
  50. </nav>
  51. <?php endif; // check for comment navigation ?>
  52. <hr class="hr-row-divider">
  53. <?php
  54. /* If there are no comments and comments are closed, let's leave a little note, shall we?
  55. * But we don't want the note on pages or post types that do not support comments.
  56. */
  57. elseif ( ! comments_open() && ! is_page() && post_type_supports( get_post_type(), 'comments' ) ) :
  58. ?>
  59. <p class="nocomments hero-p"><?php echo 'Comments are closed.'; ?></p>
  60. <?php endif; ?>
  61. <?php
  62. comment_form( array(
  63. 'comment_field' => '<p class="comment-form-comment">
  64. <label for="comment">Comment</label>
  65. <textarea id="comment" class="span8" name="comment" cols="45" rows="8" aria-required="true"></textarea>
  66. </p>'
  67. ));
  68. ?>
  69. </div><!-- #comments -->