1 | <?php |
||
2 | /** |
||
3 | * The template for displaying Comments. |
||
4 | * |
||
5 | * @package lsx |
||
6 | */ |
||
7 | |||
8 | if ( post_password_required() ) { |
||
9 | return; |
||
10 | } |
||
11 | |||
12 | $commenter = wp_get_current_commenter(); |
||
13 | $req = get_option( 'require_name_email' ); |
||
14 | $aria_req = ( $req ? " aria-required='true'" : '' ); |
||
15 | $html_req = ( $req ? " required='required'" : '' ); |
||
16 | |||
17 | $comment_form_args = array( |
||
18 | 'comment_field' => '<p class="comment-form-comment"><textarea placeholder="' . esc_html__( 'Comment', 'lsx' ) . '" id="comment" class="form-control" name="comment" cols="45" rows="8"' . $aria_req . $html_req . '></textarea></p>', |
||
19 | |||
20 | 'fields' => array( |
||
21 | 'author' => '<p class="comment-form-author"><label for="author">' . esc_html__( 'Name', 'lsx' ) . '</label> ' . |
||
22 | ( $req ? '<span class="required">*</span>' : '' ) . |
||
23 | '<input class="form-control" placeholder="' . esc_html__( 'Name', 'lsx' ) . '" id="author" name="author" type="text" value="' . esc_attr( $commenter['comment_author'] ) . '" size="30"' . $aria_req . $html_req . '></p>', |
||
24 | |||
25 | 'email' => '<p class="comment-form-email"><label for="email">' . esc_html__( 'Email', 'lsx' ) . '</label> ' . |
||
26 | ( $req ? '<span class="required">*</span>' : '' ) . |
||
27 | '<input class="form-control" placeholder="' . esc_html__( 'Email', 'lsx' ) . '" id="email" name="email" type="text" value="' . esc_attr( $commenter['comment_author_email'] ) . '" size="30"' . $aria_req . $html_req . '></p>', |
||
28 | |||
29 | 'url' => '<p class="comment-form-url"><label for="url">' . esc_html__( 'Website', 'lsx' ) . '</label>' . |
||
30 | '<input class="form-control" placeholder="' . esc_html__( 'Website', 'lsx' ) . '" id="url" name="url" type="text" value="' . esc_attr( $commenter['comment_author_url'] ) . '" size="30"></p>', |
||
31 | ), |
||
32 | ); |
||
33 | |||
34 | comment_form( $comment_form_args ); |
||
35 | |||
36 | if ( have_comments() ) : ?> |
||
37 | |||
38 | <?php lsx_comments_before(); ?> |
||
39 | |||
40 | <section id="comments"> |
||
41 | <h3> |
||
42 | <?php |
||
43 | $comments_number = get_comments_number(); |
||
44 | |||
45 | if ( '1' === $comments_number ) { |
||
46 | printf( |
||
47 | /* Translators: %s: post title */ |
||
48 | esc_html_x( 'One Response to “%s”', 'comments.php', 'lsx' ), |
||
49 | get_the_title() |
||
0 ignored issues
–
show
introduced
by
![]() |
|||
50 | ); |
||
51 | } else { |
||
52 | printf( |
||
53 | esc_html( |
||
54 | /* Translators: 1: number of comments, 2: post title */ |
||
55 | _nx( |
||
56 | '%1$s Response to “%2$s”', |
||
57 | '%1$s Responses to “%2$s”', |
||
58 | $comments_number, |
||
59 | 'comments.php', |
||
60 | 'lsx' |
||
61 | ) |
||
62 | ), |
||
63 | esc_html( number_format_i18n( $comments_number ) ), |
||
64 | get_the_title() |
||
0 ignored issues
–
show
|
|||
65 | ); |
||
66 | } |
||
67 | ?> |
||
68 | </h3> |
||
69 | |||
70 | <ol class="media-list"> |
||
71 | <?php |
||
72 | wp_list_comments( |
||
73 | array( |
||
74 | 'walker' => new LSX_Walker_Comment(), |
||
75 | ) |
||
76 | ); |
||
77 | ?> |
||
78 | </ol> |
||
79 | |||
80 | <?php |
||
81 | $comment_pages_count = get_comment_pages_count(); |
||
82 | if ( $comment_pages_count > 1 && get_option( 'page_comments' ) ) : |
||
83 | ?> |
||
84 | <nav> |
||
85 | <ul class="pager"> |
||
86 | <?php if ( get_previous_comments_link() ) : ?> |
||
87 | <li class="previous"><?php previous_comments_link( esc_html__( '← Older comments', 'lsx' ) ); ?></li> |
||
88 | <?php endif; ?> |
||
89 | |||
90 | <?php if ( get_next_comments_link() ) : ?> |
||
91 | <li class="next"><?php next_comments_link( esc_html__( 'Newer comments →', 'lsx' ) ); ?></li> |
||
92 | <?php endif; ?> |
||
93 | </ul> |
||
94 | </nav> |
||
95 | <?php endif; ?> |
||
96 | |||
97 | <?php if ( ! comments_open() && ! is_page() && post_type_supports( get_post_type(), 'comments' ) ) : ?> |
||
98 | <div class="alert alert-warning"> |
||
99 | <?php esc_html_e( 'Comments are closed.', 'lsx' ); ?> |
||
100 | </div> |
||
101 | <?php endif; ?> |
||
102 | </section><!-- /#comments --> |
||
103 | |||
104 | <?php lsx_comments_after(); ?> |
||
105 | |||
106 | <?php endif; ?> |
||
107 | |||
108 | <?php if ( ! have_comments() && ! comments_open() && post_type_supports( get_post_type(), 'comments' ) ) : ?> |
||
109 | |||
110 | <section id="comments"> |
||
111 | <div class="alert alert-warning"> |
||
112 | <?php esc_html_e( 'Comments are closed.', 'lsx' ); ?> |
||
113 | </div> |
||
114 | </section><!-- /#comments --> |
||
115 | |||
116 | <?php lsx_comments_after(); ?> |
||
117 | |||
118 | <?php |
||
119 | endif; |
||
120 | ?> |
||
121 |