File: /www/wwwroot/www.213n.cn/wp-content/themes/rk-blogger/comments.php
<?php
/**
* The template for displaying comments
*
* The area of the page that contains both current comments
* and the comment form.
*
* Author: wbolt team
* Author URI: https://www.wbolt.com
*/
if (post_password_required()) {
return;
}
?>
<section class="panel-inner sc-comments">
<h3 class="sc-title">发表评论</h3>
<?php
if (!comments_open() && get_comments_number() && post_type_supports(get_post_type(), 'comments')) :
?>
<p class="no-comments"><?php _e('Comments are closed.', 'rk-blogger'); ?></p>
<?php endif; ?>
<div id="comments">
<?php
$commenter = wp_get_current_commenter();
$req = get_option('require_name_email');
$aria_req = ($req ? " aria-required='true'" : '');
$post_id = get_the_ID();
$fields = array(
'author' => '<label class="form-item">
<input class="form-control" id="author" name="author" value="" size="30"' . $aria_req . ' placeholder="' . __('Name', 'rk-blogger') . ' *" />
</label> ',
'email' => '<label class="form-item">
<input class="form-control" id="email" name="email" type="email" value="" size="30"' . $req . ' placeholder="' . __('Email', 'rk-blogger') . ' *" />
</label> ',
'url' => '<label class="form-item">
<input class="form-control" id="url" name="url" type="email" value="" size="30"' . ' placeholder="' . __('Website', 'rk-blogger') . '" />
</label> '
);
$comments_args = array(
'fields' => $fields,
'comment_field' => '<textarea
class="textarea-comments"
id="comment" name="comment"
aria-required="true"
required="required"
placeholder="' . __('Comment', 'rk-blogger') . ' *"></textarea>',
'title_reply' => '',
'comment_notes_before' => '',
'submit_button' => '<button class="wb-btn btn-primary" id="%2$s" name="%1$s" type="submit" />' . __('Submit', 'rk-blogger') . '</button>',
'submit_field' => '<p class="form-item btn-bar">%1$s %2$s</p>',
'must_log_in' => '<p class="must-log-in">' . sprintf(
__('You must be <a href="%s">logged in</a> to post a comment.', 'rk-blogger'),
wp_login_url(apply_filters('the_permalink', get_permalink($post_id), $post_id))
) . '</p>',
'logged_in_as' => '<p class="logged-in-as">' . sprintf(
__('您正以 <a href="%1$s" class="link" aria-label="%2$s">%3$s</a> 登录中, <a href="%4$s">注销</a>?', 'rk-blogger'),
get_edit_user_link(),
esc_attr(sprintf(__('Logged in as %s. Edit your profile.', 'rk-blogger'), $user_identity)),
$user_identity,
wp_logout_url(apply_filters('the_permalink', get_permalink($post_id), $post_id))
) . '</p>',
);
comment_form($comments_args);
?>
</div>
<?php if (get_comments_number() != '0') : ?>
<h4 class="title-comments"><?php _e('Comment List', 'rk-blogger'); ?>(<?php echo get_comments_number(); ?>)</h4>
<ul class="list-comments" id="wbListComments">
<?php function wbolt_comment($comment, $args, $depth)
{
$GLOBALS['comment'] = $comment; ?>
<li class="comment-item" id="li-comment-<?php comment_ID(); ?>">
<?php if (function_exists('get_avatar') && get_option('show_avatars')) {
echo '<div class="media-pic">' . get_avatar($comment, 48) . '</div>';
} ?>
<div class="media-body" id="comment-<?php comment_ID(); ?>">
<div class="comment-txt">
<div class="hd">
<p class="name"><?php printf(__('<cite class="fn">%s</cite>', 'rk-blogger'), get_comment_author_link()); ?></p>
<p class="date"><?php echo get_comment_time('Y.n.j H:m'); ?></p>
</div>
<div class="bd">
<?php if ($comment->comment_approved == '0') : ?>
<span><?php _e('Comment is being reviewed.', 'rk-blogger'); ?></span><br />
<?php else : ?>
<?php comment_text(); ?>
<?php endif; ?>
<?php comment_reply_link(array_merge($args, array('reply_text' => __('Reply', 'rk-blogger'), 'depth' => $depth, 'max_depth' => $args['max_depth']))) ?>
</div>
</div>
</div>
<?php } ?>
<?php
$comments_per_page = get_option('comments_per_page');
$default_comments_page = get_option('default_comments_page');
wp_list_comments(array(
'type' => 'comment',
'reverse_top_level' => true,
'callback' => 'wbolt_comment',
'max_depth' => 2,
'per_page' => $comments_per_page
));
?>
</ul>
<?php
/**
* 根据后台设置,设定目标加载方向
*/
$comment_pages = paginate_comments_links('echo=0');
if ($comment_pages) {
?>
<div class="loading-bar" id="wbLoadingForComment">
<i class="wb-icon-loading"></i>
</div>
<div class="view-more-bar">
<a id="wbMoreCommentBtn">
<span>更多评论</span>
<?php echo wbolt_svg_icon('wbsico-arr-more'); ?>
</a>
</div>
<div class="wb-navigation" style="display: none;" id="wbCommentPageNav" data-target="<?php echo $default_comments_page == 'newest' ? 'prev' : 'next'; ?>">
<?php echo $comment_pages; ?>
</div>
<?php
}
?>
<?php endif; ?>
</section>