-
Notifications
You must be signed in to change notification settings - Fork 4
/
Copy pathcomments.php
146 lines (93 loc) · 2.88 KB
/
comments.php
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
<?php
/**
* Comments list template
*
* @package Auberge
* @copyright WebMan Design, Oliver Juhas
*
* @since 1.0
* @version 2.5.0
*/
/**
* Return early without loading comments if:
* - the current post is protected by a password and the visitor has not yet entered the password
* - the page is a front page
* - we are not on single post page
* - comments are closed or we have have no comments to display (even if the comments are closed now, there could be some old ones)
* - post type doesn't support comments
*/
if (
post_password_required()
|| ( is_page() && is_front_page() )
|| ! ( is_page( get_the_ID() ) || is_single( get_the_ID() ) )
|| ! ( comments_open() || have_comments() )
|| ! post_type_supports( get_post_type(), 'comments' )
) {
return;
}
do_action( 'tha_comments_before' );
?>
<div id="comments" class="comments-area">
<h2 id="comments-title" class="comments-title">
<?php
printf(
esc_html( _nx( '%1$d comment on “%2$s”', '%1$d comments on “%2$s”', get_comments_number(), 'Comments list title.', 'auberge' ) ),
number_format_i18n( get_comments_number() ),
'<span>' . get_the_title() . '</span>'
);
?>
<a href="#respond" class="add-comment-link"><?php echo esc_html_x( 'Add yours →', 'Add new comment link text.', 'auberge' ); ?></a>
</h2>
<?php
/**
* Comments list
*/
if ( have_comments() ) :
if (
! comments_open()
&& '0' != get_comments_number()
) {
?>
<h3 class="comments-closed"><?php esc_html_e( 'Comments are closed. You can not add new comments.', 'auberge' ); ?></h3>
<?php
}
// Actual comments list
?>
<ol class="comment-list">
<?php
wp_list_comments( array(
'type' => 'comment', // Do not display trackbacks and pingbacks
'avatar_size' => 240,
'style' => 'ol',
'short_ping' => true
) );
?>
</ol>
<?php
// Paginated comments
if (
1 < get_comment_pages_count()
&& get_option( 'page_comments' )
) {
// There are comments to navigate through and multipaged comments are enabled in WordPress settings
?>
<nav id="comment-nav-below" class="navigation comment-navigation" role="navigation" aria-labelledby="comment-nav-below-label">
<h2 class="screen-reader-text" id="comment-nav-below-label"><?php esc_html_e( 'Comment navigation', 'auberge' ); ?></h2>
<div class="nav-links">
<div class="nav-previous"><?php previous_comments_link( esc_html__( '← Older comments', 'auberge' ) ); ?></div>
<div class="nav-next"><?php next_comments_link( esc_html__( 'Newer comments →', 'auberge' ) ); ?></div>
</div>
</nav>
<?php
}
endif; // /have_comments()
/**
* Comments form only if comments open
*/
if ( comments_open() ) {
comment_form();
}
?>
</div><!-- #comments -->
<?php
do_action( 'tha_comments_after' );