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