Files
kjweiji/single.php
T
liaoxin f09f3bbfef v1.8 — 细节优化
- 首页文案更新为'自白者的栖息地'
- 近笺 12 条 + 查看全部链接
- 笺文详情页加浏览量
- 登录弹窗替代 alert
- 评论区修复双重 border-top
- 退出登录带回跳
- 时间格式统一到秒
- 文案优化
2026-05-04 13:39:20 +08:00

49 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 H:i:s'); ?>
</span>
<span>👁 <?php echo (int) $views; ?></span>
</div>
<div class="article-body">
<?php the_content(); ?>
</div>
<?php
if (comments_open() || get_comments_number()) {
comments_template();
}
?>
</div>
<?php endwhile; ?>
<?php get_footer(); ?>