v1.0 — 功能完整版本

- 首页: Hero + 编辑推荐 + 近笺卡片 + 微言摘要
- 笺文: 列表 + 分页(头像+作者+日期+浏览量)
- 微言: 列表 + 评论折叠
- 拾影: 瀑布流 + 灯箱
- 文章详情: 封面 + 正文 + 评论
- 图片: 缩略图 soft crop,原图裁黑边
- 头像: 本地 SVG 替换 Gravatar
- 导航: 激活状态圆点指示
- 安装: 自动创建页面和菜单
This commit is contained in:
2026-05-03 22:06:59 +08:00
parent 85ce278768
commit e123fbe9e8
5 changed files with 50 additions and 18 deletions
+1 -1
View File
@@ -37,7 +37,7 @@
$posts_arr = array();
while (have_posts()) : the_post();
if ($count === 0) $pinned_id = get_the_ID();
$posts_arr[] = array('id' => get_the_ID(), 'title' => get_the_title(), 'author_id' => get_the_author_meta('ID'), 'author_name' => get_the_author_meta('display_name'), 'date' => get_the_date('Y-m-d'), 'excerpt' => kjweji_excerpt(5, 200), 'views' => kjweji_get_views(), 'url' => get_permalink(), 'thumb' => has_post_thumbnail() ? get_the_post_thumbnail_url(null, 'kjweji-card') : '');
$posts_arr[] = array('id' => get_the_ID(), 'title' => get_the_title(), 'author_id' => get_the_author_meta('ID'), 'author_name' => get_the_author_meta('display_name'), 'date' => get_the_date('Y-m-d'), 'excerpt' => kjweji_excerpt(5, 200), 'views' => kjweji_get_views(), 'url' => get_permalink(), 'thumb' => has_post_thumbnail() ? get_the_post_thumbnail_url(null, 'medium') : '');
$count++;
endwhile;
?>
+7 -4
View File
@@ -23,11 +23,14 @@ $total_pages = ceil($total / $per_page);
<div class="article-list">
<?php while ($query->have_posts()) : $query->the_post(); ?>
<a href="<?php the_permalink(); ?>" class="article-item">
<div class="article-item__main">
<span class="article-title"><?php the_title(); ?></span>
<span class="article-meta">
<span><?php the_author_meta('display_name'); ?></span>
<span><?php echo get_the_date('Y-m-d'); ?></span>
</span>
<span class="article-item__author"><?php echo get_avatar(get_the_author_meta('ID'), 14, '', '', array('class' => 'article-avatar')); ?> <?php the_author_meta('display_name'); ?></span>
</div>
<div class="article-item__meta">
<span class="article-item__date"><?php echo get_the_date('Y-m-d'); ?></span>
<span class="article-item__views">👁 <?php echo (int) kjweji_get_views(); ?></span>
</div>
</a>
<?php endwhile; ?>
</div>
+2 -4
View File
@@ -22,13 +22,11 @@ $photo_query = new WP_Query(array(
<div class="gallery-masonry">
<?php while ($photo_query->have_posts()) : $photo_query->the_post(); ?>
<a href="<?php the_permalink(); ?>" class="gallery-item">
<div class="gallery-placeholder">
<?php if (has_post_thumbnail()) : ?>
<?php the_post_thumbnail('medium', array('alt' => get_the_title())); ?>
<?php the_post_thumbnail('medium', array('alt' => get_the_title(), 'class' => 'gallery-img')); ?>
<?php else : ?>
<span>空笺</span>
<span class="gallery-empty">空笺</span>
<?php endif; ?>
</div>
<div class="gallery-caption">
<?php the_title(); ?>
· <?php the_author_meta('display_name'); ?>
+2 -2
View File
@@ -9,14 +9,14 @@ update_post_meta(get_the_ID(), 'post_views', $views + 1);
<?php while (have_posts()) : the_post(); ?>
<div class="article-full">
<?php if (get_post_type() === 'post') : ?>
<a href="/" class="back-link">← 返回首页</a>
<a href="/articles/" class="back-link">← 返回笺文</a>
<?php elseif (get_post_type() === 'tucao') : ?>
<a href="<?php echo esc_url(get_post_type_archive_link('tucao')); ?>" class="back-link">← 返回微言</a>
<?php endif; ?>
<?php if (has_post_thumbnail()) : ?>
<div class="article-cover">
<?php the_post_thumbnail('kjweji-featured', array('alt' => get_the_title())); ?>
<?php the_post_thumbnail('medium', array('alt' => get_the_title())); ?>
</div>
<?php endif; ?>
+34 -3
View File
@@ -99,7 +99,7 @@ Text Domain: kj-weji
.pinned-cover { width:120px; height:120px; border-radius:var(--radius); flex-shrink:0; background:linear-gradient(135deg, #e8dccf 0%, #d5c4aa 100%); display:flex; align-items:center; justify-content:center; font-size:48px; }
.pinned-info h3 { font-size:20px; letter-spacing:0.06em; margin-bottom:8px; }
.pinned-info .pinned-excerpt { font-size:13px; color:var(--ink-light); line-height:1.9; font-family:"Noto Sans SC","PingFang SC","Microsoft YaHei",sans-serif; }
.pinned-info .pinned-meta { margin-top:10px; font-size:12px; color:var(--ink-lighter); font-family:"Noto Sans SC","PingFang SC","Microsoft YaHei",sans-serif; }
.pinned-info { flex: 1; } .pinned-info .pinned-meta { margin-top:10px; font-size:12px; color:var(--ink-lighter); font-family:"Noto Sans SC","PingFang SC","Microsoft YaHei",sans-serif; }
.section-header { display:flex; justify-content:space-between; align-items:baseline; margin-bottom:24px; }
.section-title { font-size:17px; letter-spacing:0.08em; font-weight:600; }
@@ -169,7 +169,7 @@ Text Domain: kj-weji
/* 画廊瀑布流 */
.gallery-masonry { column-count:3; column-gap:20px; }
.gallery-masonry .gallery-item { break-inside:avoid; margin-bottom:20px; border-radius:var(--radius); overflow:hidden; cursor:pointer; border:1px solid var(--border-light); background:var(--white); transition:all 0.3s; position:relative; display:flex; align-items:center; justify-content:center; }
.gallery-masonry .gallery-item { break-inside:avoid; margin-bottom:20px; border-radius:var(--radius); overflow:hidden; cursor:pointer; border:1px solid var(--border-light); background:var(--white); transition:all 0.3s; position:relative; display:block; line-height:0; }
.gallery-masonry .gallery-item:hover { transform:scale(1.02); box-shadow:0 4px 20px rgba(44,36,22,0.12); border-color:var(--cinnabar-light); }
.gallery-placeholder { width:100%; display:flex; align-items:center; justify-content:center; font-size:56px; color:#d5ccbb; background:linear-gradient(135deg, #faf7f0 0%, #f0ebe0 100%); }
.gallery-caption { position:absolute; bottom:0; left:0; right:0; padding:12px 16px; background:linear-gradient(transparent, rgba(0,0,0,0.5)); color:#fff; font-size:12px; opacity:0; transition:opacity 0.3s; font-family:"Noto Sans SC","PingFang SC","Microsoft YaHei",sans-serif; }
@@ -244,7 +244,6 @@ Text Domain: kj-weji
}
.pinned-meta { display: flex; align-items: center; gap: 12px; flex-wrap: wrap; }
.pinned-meta span:last-child { margin-left: auto; }
.card-cover img, .pinned-cover img, .article-cover img, .gallery-placeholder img {
width: 100%; height: 100%; object-fit: cover;
}
.card-cover { overflow: hidden; }
@@ -270,3 +269,35 @@ body.archive .site,
body.home .site,
body .site { width: 100% !important; }
.platform { width: 100% !important; max-width: 960px !important; }
.article-item { display:flex; justify-content:space-between; align-items:center; padding:18px 0; border-bottom:1px solid var(--border-light); cursor:pointer; transition:all 0.25s; text-decoration:none; color:inherit; }
.article-item:hover { padding-left:12px; border-bottom-color:var(--cinnabar-light); }
.article-item__main { flex:1; min-width:0; }
.article-title { font-size:16px; letter-spacing:0.05em; display:block; }
.article-item__author { display:inline-flex; align-items:center; gap:4px; font-size:12px; color:var(--ink-lighter); margin-top:4px; }
.article-avatar { width:14px !important; height:14px !important; border-radius:50% !important; }
.article-item__meta { display:flex; flex-direction:column; align-items:flex-end; gap:2px; font-size:12px; color:var(--ink-lighter); white-space:nowrap; margin-left:24px; }
.article-item__date { font-size:12px; color:var(--ink-lighter); }
.article-item__views { font-size:11px; color:var(--ink-lighter); }
EOF
docker exec agent-blog-theme-wordpress-1 apache2ctl graceful
echo "done"
/* Gallery image fix */
.gallery-img { display:block !important; width:100% !important; height:auto !important; }
.gallery-empty { display:flex; align-items:center; justify-content:center; min-height:160px; color:var(--ink-lighter); background:linear-gradient(135deg, #faf7f0 0%, #f0ebe0 100%); }
/* Card & pinned cover image constraints */
.card-cover img, .pinned-cover img, .article-cover img, .gallery-img {
width: 100% !important;
height: 100% !important;
object-fit: cover !important;
}
.card-cover { overflow: hidden; aspect-ratio: 16/9; }
.pinned-cover { overflow: hidden; width: 120px; height: 120px; }
.article-cover { overflow: hidden; height: 240px; }
/* Thumbnail fix — regenerate without black bars */