85ce278768
页面:首页、笺文、微言、拾影、文章详情、作者页 功能:三种展示方式、tucao 自定义类型、评论、分页、灯箱 CSS:DeepSeek 原 CSS + 系统字体 + 头像本地化 安装:激活主题后自动创建页面和导航,刷新固定链接即可
49 lines
2.3 KiB
PHP
49 lines
2.3 KiB
PHP
<?php
|
||
/**
|
||
* 微言归档页 — 带评论
|
||
*/
|
||
get_header();
|
||
?>
|
||
|
||
<div class="section-header">
|
||
<span class="section-title">💬 微言</span>
|
||
<span class="section-filter" style="font-size:13px;color:var(--ink-lighter);">片语只言,皆是存在</span>
|
||
</div>
|
||
|
||
<?php if (have_posts()) : ?>
|
||
<?php while (have_posts()) : the_post(); ?>
|
||
<div class="tucao-item" id="tucao-<?php the_ID(); ?>">
|
||
<div class="tucao-header">
|
||
<?php echo get_avatar(get_the_author_meta('ID'), 16, '', '', array('class' => 'tucao-avatar')); ?>
|
||
<span class="tucao-author"><?php the_author_meta('display_name'); ?></span>
|
||
<span class="tucao-time"><?php echo get_the_time('Y-m-d H:i'); ?></span>
|
||
</div>
|
||
<div class="tucao-body"><?php the_content(); ?></div>
|
||
<?php
|
||
$comment_count = get_comments_number();
|
||
?>
|
||
<span class="tucao-comments-toggle" onclick="document.getElementById('tucao-comments-<?php the_ID(); ?>').classList.toggle('open')">💬 <?php echo $comment_count; ?> 条留言</span>
|
||
<div class="tucao-comments" id="tucao-comments-<?php the_ID(); ?>">
|
||
<?php
|
||
$comments = get_comments(array('post_id' => get_the_ID(), 'status' => 'approve'));
|
||
foreach ($comments as $c) {
|
||
echo '<div class="tucao-comment"><span class="tucao-comment-author">' . esc_html($c->comment_author) . '</span> · ' . esc_html($c->comment_date) . '<br>' . esc_html($c->comment_content) . '</div>';
|
||
}
|
||
?>
|
||
<form action="<?php echo site_url('/wp-comments-post.php'); ?>" method="post" class="tucao-comment-form">
|
||
<input type="hidden" name="comment_post_ID" value="<?php the_ID(); ?>">
|
||
<input type="text" name="comment" placeholder="说点什么...">
|
||
<button type="submit">落笔</button>
|
||
</form>
|
||
</div>
|
||
</div>
|
||
<?php endwhile; ?>
|
||
<nav class="pagination">
|
||
<?php echo paginate_links(array('prev_text' => '‹', 'next_text' => '›')); ?>
|
||
</nav>
|
||
<?php else : ?>
|
||
<p style="color:var(--ink-lighter);text-align:center;padding:60px 0;">暂无微言</p>
|
||
<?php endif; ?>
|
||
|
||
<?php get_footer(); ?>
|