diff --git a/comments.php b/comments.php index 0d6e8b30..48a39fdd 100644 --- a/comments.php +++ b/comments.php @@ -13,7 +13,7 @@
    'comment', diff --git a/functions.php b/functions.php index 004e6b45..ecdcd0ab 100644 --- a/functions.php +++ b/functions.php @@ -1003,7 +1003,7 @@ function upvote_comment(){ function argon_comment_format($comment, $args, $depth){ global $comment_enable_upvote, $comment_enable_pinning; $GLOBALS['comment'] = $comment; - if (user_can_view_comment(get_comment_ID())){ + if (!($comment -> placeholder) && user_can_view_comment(get_comment_ID())){ ?>
  1. ">
    @@ -1737,13 +1737,32 @@ function argon_get_comments(){ $comment_query = new WP_Comment_Query; $comments = $comment_query -> query($args); - - /*$comments_count = $comment_query -> found_comments; - $comments_per_page = get_option('comments_per_page'); - $comments_pages = ceil($comments_count / $comments_per_page);*/ if (get_option("argon_enable_comment_pinning", "false") == "true"){ usort($comments, "argon_comment_cmp"); + }else{ + $comments = array_reverse($comments); + } + + //向评论数组中填充 placeholder comments 以填满第一页 + if (get_option("argon_comment_pagination_type", "feed") == "page"){ + return $comments; + } + $comments_per_page = get_option('comments_per_page'); + $comments_count = 0; + foreach ($comments as $comment){ + if ($comment -> comment_parent == 0){ + $comments_count++; + } + } + $comments_pages = ceil($comments_count / $comments_per_page); + if ($comments_pages > 1){ + $placeholders_count = $comments_pages * $comments_per_page - $comments_count; + while ($placeholders_count--){ + array_unshift($comments, new WP_Comment((object) array( + "placeholder" => true + ))); + } } return $comments; } @@ -4214,7 +4233,34 @@ function themeoptions_page(){ -



    +

    +
    +
    + 最后一页,在每个页面顶部显示新的评论"。', 'argon');?> >>> + $(".go-to-wp-comment-settings").addClass("wrong-options");'; + };?> + + +