/templates/comments.php

https://bitbucket.org/jasonbahl/mhwp · PHP · 206 lines · 150 code · 56 blank · 0 comment · 46 complexity · 7219cf60587490beff8eab90af02516d MD5 · raw file

  1. <?php
  2. if (post_password_required()) {
  3. return;
  4. }
  5. <<<<<<< HEAD
  6. if (have_comments()) : ?>
  7. <section id="comments">
  8. <h3><?php printf(_n('One Response to &ldquo;%2$s&rdquo;', '%1$s Responses to &ldquo;%2$s&rdquo;', get_comments_number(), 'mhwp'), number_format_i18n(get_comments_number()), get_the_title()); ?></h3>
  9. <ol class="media-list">
  10. <?php wp_list_comments(array('walker' => new MHWP_Walker_Comment)); ?>
  11. </ol>
  12. <?php if (get_comment_pages_count() > 1 && get_option('page_comments')) : ?>
  13. <nav>
  14. <ul class="pager">
  15. <?php if (get_previous_comments_link()) : ?>
  16. <li class="previous"><?php previous_comments_link(__('&larr; Older comments', 'mhwp')); ?></li>
  17. <?php endif; ?>
  18. <?php if (get_next_comments_link()) : ?>
  19. <li class="next"><?php next_comments_link(__('Newer comments &rarr;', 'mhwp')); ?></li>
  20. <?php endif; ?>
  21. </ul>
  22. </nav>
  23. <?php endif; ?>
  24. <?php if (!comments_open() && !is_page() && post_type_supports(get_post_type(), 'comments')) : ?>
  25. <div class="alert">
  26. <?php _e('Comments are closed.', 'mhwp'); ?>
  27. </div>
  28. <?php endif; ?>
  29. </section><!-- /#comments -->
  30. <?php endif; ?>
  31. <?php if (!have_comments() && !comments_open() && !is_page() && post_type_supports(get_post_type(), 'comments')) : ?>
  32. <section id="comments">
  33. <div class="alert">
  34. <?php _e('Comments are closed.', 'mhwp'); ?>
  35. </div>
  36. </section><!-- /#comments -->
  37. <?php endif; ?>
  38. <?php if (comments_open()) : ?>
  39. <section id="respond">
  40. <h3><?php comment_form_title(__('Leave a Reply', 'mhwp'), __('Leave a Reply to %s', 'mhwp')); ?></h3>
  41. <p class="cancel-comment-reply"><?php cancel_comment_reply_link(); ?></p>
  42. <?php if (get_option('comment_registration') && !is_user_logged_in()) : ?>
  43. <p><?php printf(__('You must be <a href="%s">logged in</a> to post a comment.', 'mhwp'), wp_login_url(get_permalink())); ?></p>
  44. <?php else : ?>
  45. <form action="<?php echo get_option('siteurl'); ?>/wp-comments-post.php" method="post" id="commentform">
  46. <?php if (is_user_logged_in()) : ?>
  47. <p>
  48. <?php printf(__('Logged in as <a href="%s/wp-admin/profile.php">%s</a>.', 'mhwp'), get_option('siteurl'), $user_identity); ?>
  49. <a href="<?php echo wp_logout_url(get_permalink()); ?>" title="<?php __('Log out of this account', 'mhwp'); ?>"><?php _e('Log out &raquo;', 'mhwp'); ?></a>
  50. </p>
  51. <?php else : ?>
  52. <div class="form-group">
  53. <label for="author"><?php _e('Name', 'mhwp'); if ($req) _e(' (required)', 'mhwp'); ?></label>
  54. <input type="text" class="form-control" name="author" id="author" value="<?php echo esc_attr($comment_author); ?>" size="22" <?php if ($req) echo 'aria-required="true"'; ?>>
  55. </div>
  56. <div class="form-group">
  57. <label for="email"><?php _e('Email (will not be published)', 'mhwp'); if ($req) _e(' (required)', 'mhwp'); ?></label>
  58. <input type="email" class="form-control" name="email" id="email" value="<?php echo esc_attr($comment_author_email); ?>" size="22" <?php if ($req) echo 'aria-required="true"'; ?>>
  59. </div>
  60. <div class="form-group">
  61. <label for="url"><?php _e('Website', 'mhwp'); ?></label>
  62. <input type="url" class="form-control" name="url" id="url" value="<?php echo esc_attr($comment_author_url); ?>" size="22">
  63. </div>
  64. <?php endif; ?>
  65. <div class="form-group">
  66. <label for="comment"><?php _e('Comment', 'mhwp'); ?></label>
  67. <textarea name="comment" id="comment" class="form-control" rows="5" aria-required="true"></textarea>
  68. </div>
  69. <p><input name="submit" class="btn btn-primary" type="submit" id="submit" value="<?php _e('Submit Comment', 'mhwp'); ?>"></p>
  70. <?php comment_id_fields(); ?>
  71. <?php do_action('comment_form', $post->ID); ?>
  72. </form>
  73. <?php endif; ?>
  74. </section><!-- /#respond -->
  75. <?php endif; ?>
  76. =======
  77. if (post_password_required()) {
  78. return;
  79. }
  80. if (have_comments()) : ?>
  81. <section id="comments">
  82. <h3><?php printf(_n('One Response to &ldquo;%2$s&rdquo;', '%1$s Responses to &ldquo;%2$s&rdquo;', get_comments_number(), 'roots'), number_format_i18n(get_comments_number()), get_the_title()); ?></h3>
  83. <ol class="media-list">
  84. <?php wp_list_comments(array('walker' => new Roots_Walker_Comment)); ?>
  85. </ol>
  86. <?php if (get_comment_pages_count() > 1 && get_option('page_comments')) : ?>
  87. <nav>
  88. <ul class="pager">
  89. <?php if (get_previous_comments_link()) : ?>
  90. <li class="previous"><?php previous_comments_link(__('&larr; Older comments', 'roots')); ?></li>
  91. <?php endif; ?>
  92. <?php if (get_next_comments_link()) : ?>
  93. <li class="next"><?php next_comments_link(__('Newer comments &rarr;', 'roots')); ?></li>
  94. <?php endif; ?>
  95. </ul>
  96. </nav>
  97. <?php endif; ?>
  98. <?php if (!comments_open() && !is_page() && post_type_supports(get_post_type(), 'comments')) : ?>
  99. <div class="alert alert-warning">
  100. <?php _e('Comments are closed.', 'roots'); ?>
  101. </div>
  102. <?php endif; ?>
  103. </section><!-- /#comments -->
  104. <?php endif; ?>
  105. <?php if (!have_comments() && !comments_open() && !is_page() && post_type_supports(get_post_type(), 'comments')) : ?>
  106. <section id="comments">
  107. <div class="alert alert-warning">
  108. <?php _e('Comments are closed.', 'roots'); ?>
  109. </div>
  110. </section><!-- /#comments -->
  111. <?php endif; ?>
  112. <?php if (comments_open()) : ?>
  113. <section id="respond">
  114. <h3><?php comment_form_title(__('Leave a Reply', 'roots'), __('Leave a Reply to %s', 'roots')); ?></h3>
  115. <p class="cancel-comment-reply"><?php cancel_comment_reply_link(); ?></p>
  116. <?php if (get_option('comment_registration') && !is_user_logged_in()) : ?>
  117. <p><?php printf(__('You must be <a href="%s">logged in</a> to post a comment.', 'roots'), wp_login_url(get_permalink())); ?></p>
  118. <?php else : ?>
  119. <form action="<?php echo get_option('siteurl'); ?>/wp-comments-post.php" method="post" id="commentform">
  120. <?php if (is_user_logged_in()) : ?>
  121. <p>
  122. <?php printf(__('Logged in as <a href="%s/wp-admin/profile.php">%s</a>.', 'roots'), get_option('siteurl'), $user_identity); ?>
  123. <a href="<?php echo wp_logout_url(get_permalink()); ?>" title="<?php __('Log out of this account', 'roots'); ?>"><?php _e('Log out &raquo;', 'roots'); ?></a>
  124. </p>
  125. <?php else : ?>
  126. <div class="form-group">
  127. <label for="author"><?php _e('Name', 'roots'); if ($req) _e(' (required)', 'roots'); ?></label>
  128. <input type="text" class="form-control" name="author" id="author" value="<?php echo esc_attr($comment_author); ?>" size="22" <?php if ($req) echo 'aria-required="true"'; ?>>
  129. </div>
  130. <div class="form-group">
  131. <label for="email"><?php _e('Email (will not be published)', 'roots'); if ($req) _e(' (required)', 'roots'); ?></label>
  132. <input type="email" class="form-control" name="email" id="email" value="<?php echo esc_attr($comment_author_email); ?>" size="22" <?php if ($req) echo 'aria-required="true"'; ?>>
  133. </div>
  134. <div class="form-group">
  135. <label for="url"><?php _e('Website', 'roots'); ?></label>
  136. <input type="url" class="form-control" name="url" id="url" value="<?php echo esc_attr($comment_author_url); ?>" size="22">
  137. </div>
  138. <?php endif; ?>
  139. <div class="form-group">
  140. <label for="comment"><?php _e('Comment', 'roots'); ?></label>
  141. <textarea name="comment" id="comment" class="form-control" rows="5" aria-required="true"></textarea>
  142. </div>
  143. <p><input name="submit" class="btn btn-primary" type="submit" id="submit" value="<?php _e('Submit Comment', 'roots'); ?>"></p>
  144. <?php comment_id_fields(); ?>
  145. <?php do_action('comment_form', $post->ID); ?>
  146. </form>
  147. <?php endif; ?>
  148. </section><!-- /#respond -->
  149. <?php endif; ?>
  150. >>>>>>> 175057a145d727f5260fa72bec52faf7a485b18e