WordPress评论文件comments.php的内容。
<?php
if (isset($_SERVER['SCRIPT_FILENAME']) && 'comments.php' == basename($_SERVER['SCRIPT_FILENAME']))
die ('Please do not load this page directly. Thanks!');
?>
<?php
if ( post_password_required() ) {
return;
}
?>
<div id="comments" class="comments-area">
<?php if ( have_comments() ) : ?>
<h3 class="comments-title bg-fd">
<?php
$comments_number = get_comments_number();
if ( 1 === $comments_number ) {
/* translators: %s: post title */
printf( _x( 'One thought on “%s”', 'comments title', 'logojiang' ), get_the_title() );
} else {
printf(
/* translators: 1: number of comments, 2: post title */
_nx(
'%1$s 条评论 “%2$s”',
'%1$s 条评论 “%2$s”',
$comments_number,
'comments title',
'logojiang'
),
number_format_i18n( $comments_number ),
get_the_title()
);
}
?>
</h3>
<ol class="comment-list neirong">
<?php
wp_list_comments( array(
'style' => 'ol',
'short_ping' => true,
'avatar_size' => 35,
) );
?>
<div class="list-inline text-center list-page neirong">
<ul class="pagination">
<?php
// 如果用户在后台选择要显示评论分页
if (get_option('page_comments')) {
// 获取评论分页的 HTML
$comment_pages = paginate_comments_links('echo=0');
// 如果评论分页的 HTML 不为空, 显示导航式分页
if ($comment_pages) {
?>
<div id="commentnavi">
<?php echo $comment_pages; ?>
</div>
<?php
}
}
?>
</ul>
</div>
</ol><!-- .comment-list -->
<?php endif; // Check for have_comments(). ?>
<?php
// If comments are closed and there are comments, let's leave a little note, shall we?
if ( ! comments_open() && get_comments_number() && post_type_supports( get_post_type(), 'comments' ) ) :
?>
<p class="no-comments"><?php _e( 'Comments are closed.', 'logojiang' ); ?></p>
<?php endif; ?>
<?php
comment_form( array(
'title_reply_before' => '<h3 id="reply-title" class="comment-reply-title bg-fd">',
'title_reply_after' => '</h3>',
) );
?>
</div><!-- .comments-area -->