function island_comment($comment, $args, $depth) { $GLOBALS['comment'] = $comment; global $commentcount, $page; if ((int) get_option('page_comments') === 1 && (int) get_option('thread_comments') === 1) { //开启嵌套评论和分页才启用 if (!$commentcount) { //初始化楼层计数器 $page = !empty($in_comment_loop) ? get_query_var('cpage') : get_page_of_comment($comment->comment_ID, $args); //获取当前评论列表页码 $cpp = get_option('comments_per_page'); //获取每页评论显示数量 if (!$post_id) { $post_id = get_the_ID(); } if (get_option('comment_order') === 'desc') { //倒序 $cnt = get_comments(array('status' => 'approve', 'parent' => '0', 'post_id' => $post_id, 'count' => true)); if (ceil($cnt / $cpp) == 1 || $page > 1 && $page == ceil($cnt / $cpp)) { $commentcount = $cnt + 1; } else { $commentcount = $cpp * $page + 1; } } else { $commentcount = $cpp * ($page - 1); } } if (!($parent_id = $comment->comment_parent)) { $commentcountText = ''; if (get_option('comment_order') === 'desc') { //倒序 $commentcountText .= --$commentcount . '楼'; } else { $commentcountText .= ++$commentcount . '楼'; } } } ?> <li <?php comment_class('clearfix'); ?> id="li-comment-<?php comment_ID(); ?> "> <span class="commentcount"><?php echo $commentcountText; ?> </span> <div class="comment-block" id="comment-<?php comment_ID(); ?> "> <div class="author-img"><?php echo get_avatar($comment->comment_author_email, 50); ?> </div> <div class="comment-body"> <div class="comment-name"><?php printf(__('<cite class="fn">%s</cite>', 'island'), get_comment_author_link()); comment_admin_title($comment->comment_author_email); ?> </div> <div class="comment-text"> <?php comment_text(); ?> </div> <div class="comment-info"> <span class="comment-date"> <a class="comment-time" href="<?php echo esc_url(get_comment_link($comment->comment_ID)); ?> "> <?php printf(__('%1$s - %2$s', 'island'), get_comment_date('m/d/Y'), get_comment_time()); ?> </a> </span> <span class="comment-reply"> <?php comment_reply_link(array_merge($args, array('depth' => $depth, 'max_depth' => $args['max_depth']))); ?> </span> <span class="comment-edit"> <?php edit_comment_link(__('(Edit)', 'island'), ' ', ''); ?> </span> <div class="clearfix"></div> </div> <?php if ($comment->comment_approved == '0') { ?> <em class="comment-awaiting-moderation"> <?php _e('Your comment is awaiting moderation.', 'island'); ?> </em> <?php } ?> <div class="clearfix"></div> </div> </div> <?php }
comment_ID(); ?> "> <span class="commentcount"><?php echo $commentcountText; ?> </span> <div class="comment-block" id="comment-<?php comment_ID(); ?> "> <div class="author-img"><?php echo get_avatar($comment->comment_author_email, 50); ?> </div> <div class="comment-body"> <div class="comment-name"><?php printf(__('<cite class="fn">%s</cite>', 'island'), get_comment_author_link()); comment_admin_title($comment->comment_author_email); ?> </div> <div class="comment-text"> <?php comment_text(); ?> </div> <div class="comment-info"> <span class="comment-date"> <a class="comment-time" href="<?php echo esc_url(get_comment_link($comment->comment_ID));