Passed
Push — master ( fc82b5...704b83 )
by SILENT
02:25
created

comments.php (1 issue)

Severity

Upgrade to new PHP Analysis Engine

These results are based on our legacy PHP analysis, consider migrating to our new PHP analysis engine instead. Learn more

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( esc_html_x( 'One Reply to &ldquo;%s&rdquo;', 'comments title', 'strip' ), get_the_title() );
37
			} else {
38
				printf(
39
					esc_attr(
40
						/* translators: 1: number of comments, 2: post title */
41
						_nx(
42
							'%1$s Reply to &ldquo;%2$s&rdquo;',
43
							'%1$s Replies to &ldquo;%2$s&rdquo;',
44
							$comments_number,
45
							'comments title',
46
							'strip'
47
						)
48
					),
49
					number_format_i18n( $comments_number ),
50
					get_the_title()
51
				);
52
			}
53
			?>
54
		</h2>
55
56
		<ol class="comment-list">
57
			<?php
58
				wp_list_comments( array(
59
					'avatar_size' => 96,
60
					'style'       => 'ol',
61
					'short_ping'  => true,
62
					'reply_text'  => __( 'Reply', 'strip' ),
63
				) );
64
			?>
65
		</ol>
66
67
		<?php the_comments_pagination( array(
68
			'prev_text' => '<span class="screen-reader-text">' . __( 'Previous', 'strip' ) . '</span>',
69
			'next_text' => '<span class="screen-reader-text">' . __( 'Next', 'strip' ) . '</span>',
0 ignored issues
show
Expected a sanitizing function (see Codex for 'Data Validation'), but instead saw '__'
Loading history...
70
		) );
71
72
	endif; // Check for have_comments().
73
74
	// If comments are closed and there are comments, let's leave a little note, shall we?
75
	if ( ! comments_open() && get_comments_number() && post_type_supports( get_post_type(), 'comments' ) ) : ?>
76
77
		<p class="no-comments"><?php esc_html_e( 'Comments are closed.', 'strip' ); ?></p>
78
	<?php
79
	endif;
80
81
	comment_form();
82
	?>
83
84
</div><!-- #comments -->
85