Passed
Push — master ( 31e91c...45a73e )
by Amit
07:11
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
 * The area of the page that contains both current comments
6
 * and the comment form.
7
 *
8
 * @package podium
9
 */
10
11
/*
12
 * If the current post is protected by a password and
13
 * the visitor has not yet entered the password we will
14
 * return early without loading the comments.
15
 */
16
17
if (post_password_required()) {
18
    return;
19
}
20
21
?>
22
23
<div id="comments" class="comments-area">
24
25
    <?php // You can start editing here -- including this comment! ?>
26
27
    <?php
28
29
    if (have_comments() && (comments_open() || get_comments_number())) {
30
        ?>
31
        <h2 class="comments-title">
32
            <?php
33
// WPCS: XSS OK.
34
            printf(
35
                esc_html(
36
                    _nx(
37
                        'One thought on &ldquo;%2$s&rdquo;',
38
                        '%1$s thoughts on &ldquo;%2$s&rdquo;',
39
                        get_comments_number(),
40
                        'comments title',
41
                        'podium'
42
                    )
43
                ),
44
                number_format_i18n(get_comments_number()),
45
                '<span>' . get_the_title() .
46
                '</span>'
47
            );
48
            ?>
49
        </h2>
50
51
        <?php
52
53 View Code Duplication
        if (get_comment_pages_count() > 1
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...
54
            && get_option('page_comments')) { // Are there comments to navigate through? ?>
55
                <nav id="comment-nav-above" class="navigation comment-navigation" role="navigation">
56
                    <h2 class="screen-reader-text"><?php esc_html_e('Comment navigation', 'podium'); ?></h2>
57
                    <div class="nav-links">
58
                        <div class="nav-previous"><?php previous_comments_link(
59
                            esc_html__('Older Comments', 'podium')
60
                        ); ?></div>
61
                            <div
62
                            class="nav-next"><?php next_comments_link(esc_html__('Newer Comments', 'podium')); ?></div>
63
64
                        </div><!-- .nav-links -->
65
                    </nav><!-- #comment-nav-above -->
66
                <?php }
67
68
    // Check for comment navigation. ?>
69
70
    <ol class="comment-list">
71
        <?php
72
        wp_list_comments([
73
            'style'      => 'ol',
74
            'short_ping' => true
75
        ]);
76
        ?>
77
    </ol><!-- .comment-list -->
78
79 View Code Duplication
    <?php if (get_comment_pages_count() > 1 && get_option('page_comments')) { ?>
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...
80
        <nav id="comment-nav-below" class="navigation comment-navigation" role="navigation">
81
            <h2 class="screen-reader-text"><?php esc_html_e('Comment navigation', 'podium'); ?></h2>
82
            <div class="nav-links">
83
                <div class="nav-previous"><?php previous_comments_link(esc_html__('Older Comments', 'podium')); ?></div>
84
                <div class="nav-next"><?php next_comments_link(esc_html__('Newer Comments', 'podium')); ?></div>
85
            </div><!-- .nav-links -->
86
        </nav><!-- #comment-nav-below -->
87
    <?php } ?>
88
<?php } ?>
89
90
<?php if (!comments_open()
91
          && '0' != get_comments_number()
92
          && post_type_supports(get_post_type(), 'comments')) {
93
    ?>
94
    <p class="no-comments"><?php esc_html_e('Comments are closed.', 'podium'); ?></p>
95
<?php } ?>
96
<?php comment_form(); ?>
97
98
</div><!-- #comments -->
99