Files
kjweiji/single.php
T
liaoxin e123fbe9e8 v1.0 — 功能完整版本
- 首页: Hero + 编辑推荐 + 近笺卡片 + 微言摘要
- 笺文: 列表 + 分页(头像+作者+日期+浏览量)
- 微言: 列表 + 评论折叠
- 拾影: 瀑布流 + 灯箱
- 文章详情: 封面 + 正文 + 评论
- 图片: 缩略图 soft crop,原图裁黑边
- 头像: 本地 SVG 替换 Gravatar
- 导航: 激活状态圆点指示
- 安装: 自动创建页面和菜单
2026-05-03 22:06:59 +08:00

50 lines
1.5 KiB
PHP

<?php get_header(); ?>
<?php
// 浏览量 +1
$views = (int) get_post_meta(get_the_ID(), 'post_views', true);
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="/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('medium', array('alt' => get_the_title())); ?>
</div>
<?php endif; ?>
<h1><?php the_title(); ?></h1>
<div class="article-byline">
<span>
<?php echo get_avatar(get_the_author_meta('ID'), 20); ?>
<a href="<?php echo esc_url(get_author_posts_url(get_the_author_meta('ID'))); ?>">
<?php the_author_meta('display_name'); ?>
</a>
· <?php echo get_the_date('Y-m-d'); ?>
</span>
</div>
<div class="article-body">
<?php the_content(); ?>
</div>
<div class="comments-section">
<?php
if (comments_open() || get_comments_number()) {
comments_template();
}
?>
</div>
</div>
<?php endwhile; ?>
<?php get_footer(); ?>