v1.10 — 评论时间/回复按钮/时区修复
- 自定义评论列表渲染(无 at 后缀,中文时间 Y-m-d H:i:s) - 回复链接恢复 - 时区设为 Asia/Shanghai - 评论样式优化
This commit is contained in:
+13
-9
@@ -12,17 +12,21 @@ if (post_password_required()) return;
|
||||
<?php if (have_comments()) : ?>
|
||||
<ol class="comment-list">
|
||||
<?php
|
||||
wp_list_comments(array(
|
||||
'style' => '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);
|
||||
?>
|
||||
<li class="comment-item">
|
||||
<div class="comment-item__meta">
|
||||
<?php echo get_avatar($c, 22, '', '', array('class' => 'comment-avatar')); ?>
|
||||
<span class="comment-item__author"><?php echo esc_html($c->comment_author); ?></span>
|
||||
<span class="comment-item__time"><?php echo get_comment_date('Y-m-d H:i:s', $c); ?></span>
|
||||
</div>
|
||||
<div class="comment-item__text"><?php echo esc_html($c->comment_content); ?></div>
|
||||
<div class="comment-item__reply"><a href="<?php echo esc_url(add_query_arg('replytocom', $c->comment_ID, get_permalink() . '#respond')); ?>">回复</a></div>
|
||||
</li>
|
||||
<?php endforeach; ?>
|
||||
</ol>
|
||||
<?php the_comments_navigation(); ?>
|
||||
<?php endif; ?>
|
||||
|
||||
<?php if (is_user_logged_in()) : ?>
|
||||
|
||||
@@ -281,3 +281,7 @@ add_filter('comment_form_defaults', function($defaults) {
|
||||
$defaults['title_reply_after'] = '</h3>';
|
||||
return $defaults;
|
||||
});
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
@@ -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); }
|
||||
|
||||
Reference in New Issue
Block a user