Completed
Push — master ( 8652fb...5f173e )
by Md. Mozahidur
02:27
created

comments.php (2 issues)

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 Lighthouse
11
 */
12
13
/*
14
 * If the current post is protected by a password and
15
 * the visitor has not yet entered the password we will
16
 * return early without loading the comments.
17
 */
18
if ( post_password_required() ) {
19
	return;
20
}
21
?>
22
23
<div id="comments" class="comments-area">
24
25
	<?php
26
	// You can start editing here -- including this comment!
27
	if ( have_comments() ) : ?>
28
		<h2 class="comments-title">
29
			<?php
30
				printf( // WPCS: XSS OK.
31
					esc_html( _nx( 'One thought on &ldquo;%2$s&rdquo;', '%1$s thoughts on &ldquo;%2$s&rdquo;', get_comments_number(), 'comments title', 'lighthouse' ) ),
32
					number_format_i18n( get_comments_number() ),
33
					'<span>' . get_the_title() . '</span>'
34
				);
35
			?>
36
		</h2>
37
38 View Code Duplication
		<?php if ( get_comment_pages_count() > 1 && get_option( 'page_comments' ) ) : // Are there comments to navigate through? ?>
0 ignored issues
show
This code seems to be duplicated across your project.

Duplicated code is one of the most pungent code smells. If you need to duplicate the same code in three or more different places, we strongly encourage you to look into extracting the code into a single class or operation.

You can also find more detailed suggestions in the “Code” section of your repository.

Loading history...
39
		<nav id="comment-nav-above" class="navigation comment-navigation" role="navigation">
40
			<h2 class="screen-reader-text"><?php esc_html_e( 'Comment navigation', 'lighthouse' ); ?></h2>
41
			<div class="nav-links">
42
43
				<div class="nav-previous"><?php previous_comments_link( esc_html__( 'Older Comments', 'lighthouse' ) ); ?></div>
44
				<div class="nav-next"><?php next_comments_link( esc_html__( 'Newer Comments', 'lighthouse' ) ); ?></div>
45
46
			</div><!-- .nav-links -->
47
		</nav><!-- #comment-nav-above -->
48
		<?php endif; // Check for comment navigation. ?>
49
50
		<ol class="comment-list">
51
			<?php
52
				wp_list_comments( array(
53
					'style'      => 'ol',
54
					'short_ping' => true,
55
				) );
56
			?>
57
		</ol><!-- .comment-list -->
58
59 View Code Duplication
		<?php if ( get_comment_pages_count() > 1 && get_option( 'page_comments' ) ) : // Are there comments to navigate through? ?>
0 ignored issues
show
This code seems to be duplicated across your project.

Duplicated code is one of the most pungent code smells. If you need to duplicate the same code in three or more different places, we strongly encourage you to look into extracting the code into a single class or operation.

You can also find more detailed suggestions in the “Code” section of your repository.

Loading history...
60
		<nav id="comment-nav-below" class="navigation comment-navigation" role="navigation">
61
			<h2 class="screen-reader-text"><?php esc_html_e( 'Comment navigation', 'lighthouse' ); ?></h2>
62
			<div class="nav-links">
63
64
				<div class="nav-previous"><?php previous_comments_link( esc_html__( 'Older Comments', 'lighthouse' ) ); ?></div>
65
				<div class="nav-next"><?php next_comments_link( esc_html__( 'Newer Comments', 'lighthouse' ) ); ?></div>
66
67
			</div><!-- .nav-links -->
68
		</nav><!-- #comment-nav-below -->
69
		<?php
70
		endif; // Check for comment navigation.
71
72
	endif; // Check for have_comments().
73
74
75
	// If comments are closed and there are comments, let's leave a little note, shall we?
76
	if ( ! comments_open() && get_comments_number() && post_type_supports( get_post_type(), 'comments' ) ) : ?>
77
78
		<p class="no-comments"><?php esc_html_e( 'Comments are closed.', 'lighthouse' ); ?></p>
79
	<?php
80
	endif;
81
82
	comment_form();
83
	?>
84
85
</div><!-- #comments -->
86