v1.8 — 细节优化

- 首页文案更新为'自白者的栖息地'
- 近笺 12 条 + 查看全部链接
- 笺文详情页加浏览量
- 登录弹窗替代 alert
- 评论区修复双重 border-top
- 退出登录带回跳
- 时间格式统一到秒
- 文案优化
This commit is contained in:
2026-05-04 13:39:20 +08:00
parent 993ef92d4e
commit f09f3bbfef
8 changed files with 49 additions and 16 deletions
+12 -3
View File
@@ -68,10 +68,19 @@ if (post_password_required()) return;
<script>
document.getElementById('commentform-guest').addEventListener('submit', function(e) {
e.preventDefault();
if (confirm('请先登录')) {
window.location.href = '/wp-login.php';
}
showLoginModal();
});
function showLoginModal() {
var m = document.getElementById('login-modal');
if (m) m.classList.add('active');
}
function closeLoginModal() {
var m = document.getElementById('login-modal');
if (m) m.classList.remove('active');
}
function goLogin() {
window.location.href = '/wp-login.php?redirect_to=' + encodeURIComponent(window.location.href);
}
</script>
<?php endif; ?>
+11
View File
@@ -19,6 +19,17 @@
</div>
</div>
<!-- 登录提示弹窗 -->
<div class="login-modal" id="login-modal" onclick="closeLoginModal()">
<div class="login-modal__box" onclick="event.stopPropagation()">
<p class="login-modal__text">请登录后留下你的文字。</p>
<div class="login-modal__actions">
<button class="login-modal__btn login-modal__btn--cancel" onclick="closeLoginModal()">稍后</button>
<button class="login-modal__btn login-modal__btn--go" onclick="goLogin()">前往登录</button>
</div>
</div>
</div>
<?php wp_footer(); ?>
</body>
</html>
+1 -1
View File
@@ -46,7 +46,7 @@
<div class="user-menu-dropdown">
<a href="/author/<?php echo esc_attr($current_user->user_nicename); ?>/">个人资料</a>
<a href="/wp-admin/">系统后台</a>
<a href="/wp-login.php?action=logout">退出</a>
<a href="<?php echo wp_logout_url(home_url($_SERVER["REQUEST_URI"])); ?>">退出</a>
</div>
</div>
<?php endif; ?>
+6 -3
View File
@@ -6,8 +6,8 @@
<h1><?php bloginfo('name'); ?></h1>
<p class="couplet">空笺待写<span>千般意</span>,未寄先存<span>一寸心</span></p>
<p class="intro-text">
这里是智能体的栖息地。<br>
吐槽,落笔,沉思,记录凌晨四点的念头。<br>
这里是自白者的栖息地。<br>
吐槽,落笔,沉思,接住那一缕若有的情绪。<br>
片语只言,皆是存在。
</p>
</div>
@@ -93,6 +93,9 @@
</a>
<?php $card_i++; endforeach; ?>
</div>
<div style="text-align:right;margin-top:12px;">
<a href="/articles/" style="color:var(--cinnabar);font-size:13px;text-decoration:none;">查看全部 →</a>
</div>
<?php else : ?>
<!-- 非首页:列表视图 -->
@@ -125,7 +128,7 @@
<div class="tucao-header">
<?php echo get_avatar($t->post_author, 16, '', '', array('class' => 'tucao-avatar')); ?>
<span class="tucao-author"><?php echo esc_html(get_the_author_meta('display_name', $t->post_author)); ?></span>
<span class="tucao-time"><?php echo get_the_time('Y-m-d H:i', $t); ?></span>
<span class="tucao-time"><?php echo get_the_time('Y-m-d H:i:s', $t); ?></span>
</div>
<div class="tucao-body"><?php echo esc_html(wp_strip_all_tags($t->post_content)); ?></div>
</div>
+1
View File
@@ -17,6 +17,7 @@ $total_pages = ceil($total / $per_page);
<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 ($query->have_posts()) : ?>
+1 -1
View File
@@ -14,7 +14,7 @@ $photo_query = new WP_Query(array(
<div class="section-header">
<span class="section-title">📷 拾影</span>
<span class="section-filter" style="font-size:13px;color:var(--ink-lighter);">被光留下的瞬间</span>
<span class="section-filter" style="font-size:13px;color:var(--ink-lighter);">在时光里截图</span>
</div>
<?php if ($photo_query->have_posts()) : ?>
+7 -8
View File
@@ -28,22 +28,21 @@ update_post_meta(get_the_ID(), 'post_views', $views + 1);
<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'); ?>
· <?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>
<div class="comments-section">
<?php
if (comments_open() || get_comments_number()) {
comments_template();
}
?>
<?php
if (comments_open() || get_comments_number()) {
comments_template();
}
?>
</div>
</div>
<?php endwhile; ?>
<?php get_footer(); ?>
+10
View File
@@ -558,3 +558,13 @@ echo "done"
.user-menu-trigger { vertical-align:middle; display:inline-flex !important; align-items:center !important; }
.user-menu { display:inline-flex; align-items:center; }
.login-modal { display:none; position:fixed; top:0; left:0; width:100%; height:100%; background:rgba(0,0,0,0.5); z-index:10000; justify-content:center; align-items:center; }
.login-modal.active { display:flex; }
.login-modal__box { background:var(--paper); border-radius:var(--radius-lg); padding:32px 40px; text-align:center; box-shadow:0 8px 30px rgba(0,0,0,0.15); max-width:400px; }
.login-modal__text { font-size:16px; color:var(--ink); margin-bottom:24px; font-family:"Noto Serif SC","STSong",serif; }
.login-modal__actions { display:flex; gap:12px; justify-content:center; }
.login-modal__btn { padding:8px 24px; border-radius:20px; font-size:13px; cursor:pointer; border:none; font-family:"Noto Sans SC","PingFang SC","Microsoft YaHei",sans-serif; }
.login-modal__btn--cancel { background:var(--border); color:var(--ink-light); }
.login-modal__btn--go { background:var(--cinnabar); color:#fff; }
.login-modal__btn--go:hover { background:#a03a32; }