From 16c3e10494f368579dceca2c10996a7dd144ad04 Mon Sep 17 00:00:00 2001 From: liaoxin Date: Sun, 3 May 2026 23:59:38 +0800 Subject: [PATCH] =?UTF-8?q?v1.1=20=E2=80=94=20=E5=9B=BE=E7=89=87/=E5=A4=B4?= =?UTF-8?q?=E5=83=8F/=E4=BD=9C=E8=80=85/=E6=97=A5=E6=9C=9F=E5=85=A8?= =?UTF-8?q?=E9=9D=A2=E4=BC=98=E5=8C=96?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit - 图片: 缩略图改为 soft crop,原图裁黑边 - 头像: 团队证件照替换 SVG,CSS 约束尺寸和圆角 - 作者: 了心/墨羽/探子三个真实用户 - 笺文列表: 左侧增加封面缩略图 - 分页: 20篇/页 - 详情页: 返回笺文链接 + 头像尺寸约束 - 作者页: 高清头像 + 中文日期 - 微言: 作者随机 + 时间匹配内容 --- author.php | 2 +- functions.php | 16 +++++++++--- page-articles.php | 7 +++++- style.css | 64 +++++++++++++++++++++++++++++++++++++++++++++++ 4 files changed, 83 insertions(+), 6 deletions(-) diff --git a/author.php b/author.php index b8fc50d..74f5e36 100644 --- a/author.php +++ b/author.php @@ -61,7 +61,7 @@ $author_query = new WP_Query(array( diff --git a/functions.php b/functions.php index 8563f9e..fcf6fca 100644 --- a/functions.php +++ b/functions.php @@ -141,11 +141,19 @@ add_action('template_include', function($template) { -// 禁用 Gravatar — 本地默认头像 +// 本地头像(团队证件照) add_filter('get_avatar', function($avatar, $id_or_email, $size, $default, $alt) { - // 用 data URI 的默认灰色圆圈替代 - $svg = ''; - return '' . $svg . ''; + $uid = 0; + if (is_numeric($id_or_email)) $uid = (int) $id_or_email; + elseif (is_object($id_or_email) && isset($id_or_email->user_id)) $uid = (int) $id_or_email->user_id; + $att_id = get_user_meta($uid, 'custom_avatar', true); + if ($att_id) { + $url = wp_get_attachment_image_url($att_id, 'medium'); + if ($url) { + return ''; + } + } + return $avatar; // fallback }, 10, 5); // 激活主题时自动初始化 diff --git a/page-articles.php b/page-articles.php index b6ac18d..8b98d5f 100644 --- a/page-articles.php +++ b/page-articles.php @@ -5,7 +5,7 @@ get_header(); $pg = isset($_GET['pg']) ? max(1, (int) $_GET['pg']) : 1; -$per_page = 3; +$per_page = 20; $query = new WP_Query(array( 'post_type' => 'post', 'posts_per_page' => $per_page, @@ -23,6 +23,11 @@ $total_pages = ceil($total / $per_page);
have_posts()) : $query->the_post(); ?> + +
+ get_the_title())); ?> +
+
'article-avatar')); ?> diff --git a/style.css b/style.css index 8dfc31f..8ba7be1 100644 --- a/style.css +++ b/style.css @@ -301,3 +301,67 @@ echo "done" .article-cover { overflow: hidden; height: 240px; } /* Thumbnail fix — regenerate without black bars */ + +.article-item__thumb { + width: 60px; + height: 60px; + border-radius: var(--radius); + overflow: hidden; + flex-shrink: 0; + margin-right: 16px; +} +.article-item__thumb img { + width: 100%; + height: 100%; + object-fit: cover; +} +.article-item { + display: flex; + align-items: center; +} + +.avatar, .pinned-avatar, .card-avatar, .tucao-avatar, .article-avatar, .avatar-sm { + object-fit: cover !important; + border-radius: 50% !important; +} + +.avatar, .pinned-avatar, .card-avatar, .tucao-avatar, .article-avatar, .avatar-sm { + object-position: center 20%; +} + +.avatar-16, .card-avatar, .tucao-avatar, .article-avatar { + width: 16px !important; + height: 16px !important; +} +.avatar-18, .pinned-avatar { + width: 18px !important; + height: 18px !important; +} +.avatar-14, .article-avatar { + width: 14px !important; + height: 14px !important; +} +.avatar-sm { + width: 16px !important; + height: 16px !important; +} + +.single-post__meta img, +.article-byline img { + width: 22px !important; + height: 22px !important; + border-radius: 50% !important; + object-fit: cover !important; + vertical-align: middle; +} +.article-byline span { + display: inline-flex; + align-items: center; + gap: 6px; +} +.author-card__avatar { + width: 56px !important; + height: 56px !important; + border-radius: 50% !important; + object-fit: cover !important; +}