|
1 <?php |
|
2 /** |
|
3 * The template for displaying comments |
|
4 * |
|
5 * This is the template that displays the area of the page that contains both the current comments |
|
6 * and the comment form. |
|
7 * |
|
8 * @link https://codex.wordpress.org/Template_Hierarchy |
|
9 * |
|
10 * @package WordPress |
|
11 * @subpackage Twenty_Seventeen |
|
12 * @since 1.0 |
|
13 * @version 1.0 |
|
14 */ |
|
15 |
|
16 /* |
|
17 * If the current post is protected by a password and |
|
18 * the visitor has not yet entered the password we will |
|
19 * return early without loading the comments. |
|
20 */ |
|
21 if ( post_password_required() ) { |
|
22 return; |
|
23 } |
|
24 ?> |
|
25 |
|
26 <div id="comments" class="comments-area"> |
|
27 |
|
28 <?php |
|
29 // You can start editing here -- including this comment! |
|
30 if ( have_comments() ) : ?> |
|
31 <h2 class="comments-title"> |
|
32 <?php |
|
33 $comments_number = get_comments_number(); |
|
34 if ( '1' === $comments_number ) { |
|
35 /* translators: %s: post title */ |
|
36 printf( _x( 'One Reply to “%s”', 'comments title', 'twentyseventeen' ), get_the_title() ); |
|
37 } else { |
|
38 printf( |
|
39 /* translators: 1: number of comments, 2: post title */ |
|
40 _nx( |
|
41 '%1$s Reply to “%2$s”', |
|
42 '%1$s Replies to “%2$s”', |
|
43 $comments_number, |
|
44 'comments title', |
|
45 'twentyseventeen' |
|
46 ), |
|
47 number_format_i18n( $comments_number ), |
|
48 get_the_title() |
|
49 ); |
|
50 } |
|
51 ?> |
|
52 </h2> |
|
53 |
|
54 <ol class="comment-list"> |
|
55 <?php |
|
56 wp_list_comments( array( |
|
57 'avatar_size' => 100, |
|
58 'style' => 'ol', |
|
59 'short_ping' => true, |
|
60 'reply_text' => twentyseventeen_get_svg( array( 'icon' => 'mail-reply' ) ) . __( 'Reply', 'twentyseventeen' ), |
|
61 ) ); |
|
62 ?> |
|
63 </ol> |
|
64 |
|
65 <?php the_comments_pagination( array( |
|
66 'prev_text' => twentyseventeen_get_svg( array( 'icon' => 'arrow-left' ) ) . '<span class="screen-reader-text">' . __( 'Previous', 'twentyseventeen' ) . '</span>', |
|
67 'next_text' => '<span class="screen-reader-text">' . __( 'Next', 'twentyseventeen' ) . '</span>' . twentyseventeen_get_svg( array( 'icon' => 'arrow-right' ) ), |
|
68 ) ); |
|
69 |
|
70 endif; // Check for have_comments(). |
|
71 |
|
72 // If comments are closed and there are comments, let's leave a little note, shall we? |
|
73 if ( ! comments_open() && get_comments_number() && post_type_supports( get_post_type(), 'comments' ) ) : ?> |
|
74 |
|
75 <p class="no-comments"><?php _e( 'Comments are closed.', 'twentyseventeen' ); ?></p> |
|
76 <?php |
|
77 endif; |
|
78 |
|
79 comment_form(); |
|
80 ?> |
|
81 |
|
82 </div><!-- #comments --> |