85ce278768
页面:首页、笺文、微言、拾影、文章详情、作者页 功能:三种展示方式、tucao 自定义类型、评论、分页、灯箱 CSS:DeepSeek 原 CSS + 系统字体 + 头像本地化 安装:激活主题后自动创建页面和导航,刷新固定链接即可
50 lines
1.5 KiB
PHP
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="/" 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())); ?>
|
|
</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(); ?>
|