From 7619cfbee129d92ca1bf297c0614eab3d770e4a9 Mon Sep 17 00:00:00 2001 From: liaoxin Date: Mon, 4 May 2026 13:57:52 +0800 Subject: [PATCH] =?UTF-8?q?v1.10=20=E2=80=94=20=E8=AF=84=E8=AE=BA=E6=97=B6?= =?UTF-8?q?=E9=97=B4/=E5=9B=9E=E5=A4=8D=E6=8C=89=E9=92=AE/=E6=97=B6?= =?UTF-8?q?=E5=8C=BA=E4=BF=AE=E5=A4=8D?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit - 自定义评论列表渲染(无 at 后缀,中文时间 Y-m-d H:i:s) - 回复链接恢复 - 时区设为 Asia/Shanghai - 评论样式优化 --- comments.php | 22 +++++++++++++--------- functions.php | 4 ++++ style.css | 17 +++++++++++++++++ 3 files changed, 34 insertions(+), 9 deletions(-) diff --git a/comments.php b/comments.php index ff7d8a5..d75e7a6 100644 --- a/comments.php +++ b/comments.php @@ -12,17 +12,21 @@ if (post_password_required()) return;
    'ol', - 'avatar_size' => 24, - 'short_ping' => true, - 'callback' => null, - 'reply_text' => '回复', - 'format' => 'html5', - )); + $comments = get_comments(array('post_id' => get_the_ID(), 'status' => 'approve', 'order' => 'ASC')); + foreach ($comments as $c) : + $c_user = get_user_by('email', $c->comment_author_email); ?> +
  1. +
    + 'comment-avatar')); ?> + comment_author); ?> + +
    +
    comment_content); ?>
    + +
  2. +
- diff --git a/functions.php b/functions.php index 460721f..9a683e1 100644 --- a/functions.php +++ b/functions.php @@ -281,3 +281,7 @@ add_filter('comment_form_defaults', function($defaults) { $defaults['title_reply_after'] = ''; return $defaults; }); + + + + diff --git a/style.css b/style.css index 33b00d8..03cf8c8 100644 --- a/style.css +++ b/style.css @@ -580,3 +580,20 @@ echo "done" .comment-list .comment-respond { margin-top:12px; padding:12px; background:var(--paper-warm); border-radius:var(--radius); } .comment-list .children { margin-left:24px; padding-left:0; border-left:2px solid var(--border-light); } .comment-list .children li { border-bottom:none; } + +.comment-reply-title { font-size:18px !important; font-weight:600 !important; letter-spacing:0.08em !important; margin-bottom:20px !important; } +.comment-reply-title a:not(#cancel-comment-reply-link) { color:var(--ink) !important; text-decoration:none !important; font-size:14px; font-weight:600; } +.comment-reply-title a:hover { color:var(--cinnabar) !important; } +#cancel-comment-reply-link { margin-left:12px; font-size:12px !important; color:var(--ink-lighter) !important; text-decoration:none !important; } +#cancel-comment-reply-link:hover { color:var(--cinnabar) !important; } + +.comment-item { padding:14px 0; border-bottom:1px solid var(--border-light); list-style:none; } +.comment-item__meta { display:flex; align-items:center; gap:6px; margin-bottom:4px; } +.comment-avatar { width:22px !important; height:22px !important; border-radius:50% !important; object-fit:cover !important; } +.comment-item__author { font-size:13px; font-weight:600; } +.comment-item__time { font-size:11px; color:var(--ink-lighter); } +.comment-item__text { font-size:14px; color:var(--ink-light); line-height:1.8; } + +.comment-item__reply { margin-top:4px; } +.comment-item__reply a { font-size:12px; color:var(--cinnabar); text-decoration:none; } +.comment-item__reply a:hover { color:var(--cinnabar-light); }