v1.2 — 拾影独立为 photo 类型

- 新增 photo 自定义文章类型(专属拾影)
- page-photos.php 只查询 photo
- single-photo.php 无封面图、返回拾影链接
- 月光森林/海岸灯塔/古镇巷子 转为 photo 类型
- 首页和笺文不包含 photo
This commit is contained in:
2026-05-04 00:00:47 +08:00
parent 16c3e10494
commit a31356628a
3 changed files with 67 additions and 1 deletions
+46
View File
@@ -0,0 +1,46 @@
<?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="/photos/" 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()) : ?>
<?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(); ?>