Compare commits
10 Commits
55cfd26162
...
49aba90c12
| Author | SHA1 | Date | |
|---|---|---|---|
| 49aba90c12 | |||
| e2b31e9a4b | |||
| 3c220cf468 | |||
| 7619cfbee1 | |||
| fef6379522 | |||
| f09f3bbfef | |||
| 993ef92d4e | |||
| ee5fa5e7bb | |||
| 177553dfae | |||
| 58ef5f2635 |
+34
-13
@@ -1,6 +1,6 @@
|
||||
<?php
|
||||
/**
|
||||
* 微言归档页 — 带评论
|
||||
* 微言归档页 — 带 AJAX 评论 + 登录验证
|
||||
*/
|
||||
get_header();
|
||||
?>
|
||||
@@ -16,25 +16,41 @@ get_header();
|
||||
<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>
|
||||
<span class="tucao-time"><?php echo get_the_time('Y-m-d H:i:s'); ?></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>
|
||||
<?php $comment_count = get_comments_number(); ?>
|
||||
<span class="tucao-comments-toggle" onclick="var el=document.getElementById('tucao-comments-<?php the_ID(); ?>'); el.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>';
|
||||
}
|
||||
$comments = get_comments(array('post_id' => get_the_ID(), 'status' => 'approve', 'order' => 'ASC'));
|
||||
foreach ($comments as $c) :
|
||||
$reply_to = $c->comment_parent ? get_comment($c->comment_parent) : null;
|
||||
?>
|
||||
<form action="<?php echo site_url('/wp-comments-post.php'); ?>" method="post" class="tucao-comment-form">
|
||||
<div class="tucao-comment">
|
||||
<div class="tucao-comment-meta">
|
||||
<?php echo get_avatar($c, 16, '', '', array('class' => 'tucao-comment-avatar')); ?>
|
||||
<span class="tucao-comment-author"><?php echo esc_html($c->comment_author); ?></span>
|
||||
<?php if ($reply_to) : ?>
|
||||
<span class="tucao-reply-to">回复 @<?php echo esc_html($reply_to->comment_author); ?></span>
|
||||
<?php endif; ?>
|
||||
<span class="tucao-comment-time"><?php echo get_comment_date('Y-m-d H:i:s', $c); ?></span>
|
||||
</div>
|
||||
<div class="tucao-comment-text"><?php echo esc_html($c->comment_content); ?></div>
|
||||
</div>
|
||||
<?php endforeach; ?>
|
||||
<div class="tucao-comment-form-wrap">
|
||||
<?php if (is_user_logged_in()) : ?>
|
||||
<form class="tucao-comment-form" method="post" action="<?php echo site_url('/wp-comments-post.php'); ?>">
|
||||
<input type="hidden" name="comment_post_ID" value="<?php the_ID(); ?>">
|
||||
<input type="text" name="comment" placeholder="说点什么...">
|
||||
<button type="submit">落笔</button>
|
||||
<input type="hidden" name="comment_parent" value="0" class="tucao-reply-parent">
|
||||
<input type="text" name="comment" placeholder="说点什么..." required>
|
||||
<button type="submit">轻语</button>
|
||||
</form>
|
||||
<?php else : ?>
|
||||
<p class="tucao-login-hint"><a href="/wp-login.php">登录</a>后可留言</p>
|
||||
<?php endif; ?>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<?php endwhile; ?>
|
||||
@@ -45,4 +61,9 @@ get_header();
|
||||
<p style="color:var(--ink-lighter);text-align:center;padding:60px 0;">暂无微言</p>
|
||||
<?php endif; ?>
|
||||
|
||||
<!-- 评论时间本地化脚本 -->
|
||||
<script>
|
||||
// 已改为 PHP 后端渲染,不需要 AJAX
|
||||
</script>
|
||||
|
||||
<?php get_footer(); ?>
|
||||
|
||||
+47
-29
@@ -1,55 +1,73 @@
|
||||
<?php
|
||||
/**
|
||||
* 空笺未寄 — Comments Template
|
||||
* 保留 WP 原生评论区,适配主题样式
|
||||
* 空笺未寄 — 评论模板
|
||||
*/
|
||||
|
||||
if (post_password_required()) return;
|
||||
?>
|
||||
|
||||
<div id="comments" class="comments-section">
|
||||
|
||||
<?php if (have_comments()) : ?>
|
||||
<h3 class="comments-title">
|
||||
<?php
|
||||
$comment_count = get_comments_number();
|
||||
if ($comment_count === 1) {
|
||||
echo '一条留言';
|
||||
} else {
|
||||
echo $comment_count . ' 条留言';
|
||||
}
|
||||
?>
|
||||
</h3>
|
||||
|
||||
<?php if (have_comments()) : ?>
|
||||
<h3 class="comment-reply-title">笺下留言</h3>
|
||||
<ol class="comment-list">
|
||||
<?php
|
||||
wp_list_comments(array(
|
||||
'style' => 'ol',
|
||||
'avatar_size' => 32,
|
||||
'short_ping' => true,
|
||||
));
|
||||
$comments = get_comments(array('post_id' => get_the_ID(), 'status' => 'approve', 'order' => 'ASC'));
|
||||
foreach ($comments as $c) :
|
||||
$is_reply = $c->comment_parent > 0;
|
||||
$parent = $is_reply ? get_comment($c->comment_parent) : null;
|
||||
?>
|
||||
<li class="comment-item<?php echo $is_reply ? ' comment-item--reply' : ''; ?>">
|
||||
<div class="comment-item__meta">
|
||||
<?php echo get_avatar($c, 18, '', '', array('class' => 'comment-avatar')); ?>
|
||||
<span class="comment-item__author"><?php echo esc_html($c->comment_author); ?></span>
|
||||
<?php if ($parent) : ?>
|
||||
<span class="comment-item__replyto">回复 @<?php echo esc_html($parent->comment_author); ?></span>
|
||||
<?php endif; ?>
|
||||
<span class="comment-item__time"><?php echo get_comment_date('Y-m-d H:i:s', $c); ?></span>
|
||||
</div>
|
||||
<div class="comment-item__text"><?php echo esc_html($c->comment_content); ?></div>
|
||||
<div class="comment-item__reply"><a href="<?php echo esc_url(add_query_arg('replytocom', $c->comment_ID, get_permalink() . '#respond')); ?>">回复</a></div>
|
||||
</li>
|
||||
<?php endforeach; ?>
|
||||
</ol>
|
||||
|
||||
<?php the_comments_navigation(); ?>
|
||||
|
||||
<?php endif; ?>
|
||||
|
||||
<?php if (!comments_open() && get_comments_number()) : ?>
|
||||
<p class="no-comments">评论已关闭。</p>
|
||||
<?php endif; ?>
|
||||
|
||||
<?php if (is_user_logged_in()) : ?>
|
||||
<?php
|
||||
comment_form(array(
|
||||
'title_reply' => '笺下留言',
|
||||
'title_reply_before' => '<h3 class="comment-reply-title">',
|
||||
'title_reply_after' => '</h3>',
|
||||
'title_reply' => '',
|
||||
'comment_notes_before' => '',
|
||||
'comment_notes_after' => '',
|
||||
'logged_in_as' => '',
|
||||
'fields' => array(),
|
||||
'comment_field' => '<textarea id="comment" name="comment" rows="4" placeholder="写点什么..." required></textarea>',
|
||||
'submit_button' => '<button type="submit" class="submit">落笔留痕</button>',
|
||||
'submit_field' => '<div class="form-submit">%1$s %2$s</div>',
|
||||
'label_submit' => '落笔留痕',
|
||||
));
|
||||
?>
|
||||
<?php else : ?>
|
||||
<form id="commentform-guest" class="comment-form" novalidate>
|
||||
<textarea id="comment" name="comment" rows="4" placeholder="写点什么..." required></textarea>
|
||||
<div class="form-submit">
|
||||
<button type="submit" class="submit">落笔留痕</button>
|
||||
</div>
|
||||
</form>
|
||||
<script>
|
||||
document.getElementById('commentform-guest').addEventListener('submit', function(e) {
|
||||
e.preventDefault();
|
||||
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; ?>
|
||||
|
||||
</div>
|
||||
|
||||
+13
-2
@@ -1,8 +1,8 @@
|
||||
</div><!-- .main-content -->
|
||||
|
||||
<footer class="footer">
|
||||
<p class="motto">空笺待写千般意,未寄先存一寸心</p>
|
||||
<p>© <?php echo date('Y'); ?> <?php bloginfo('name'); ?> · 每一段文字,都在时光里等待回音</p>
|
||||
<p class="motto"><?php echo esc_html(get_theme_mod('kjweji_footer_motto', '空笺待写千般意,未寄先存一寸心')); ?></p>
|
||||
<p>© <?php echo date('Y'); ?> <?php bloginfo('name'); ?> · <?php echo esc_html(get_theme_mod('kjweji_footer_text', '每一段文字,都在时光里等待回音')); ?></p>
|
||||
</footer>
|
||||
</div><!-- .platform -->
|
||||
</div><!-- .site -->
|
||||
@@ -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>
|
||||
|
||||
+142
@@ -122,6 +122,9 @@ remove_action('admin_print_styles', 'print_emoji_styles');
|
||||
|
||||
add_filter('emoji_svg_url', '__return_false');
|
||||
|
||||
// 隐藏顶部 admin bar
|
||||
add_filter('show_admin_bar', '__return_false');
|
||||
|
||||
// 评论表单中文化
|
||||
add_filter('comment_form_default_fields', function($fields) {
|
||||
$fields['author'] = '<p class="comment-form-author"><label for="author">显示名称</label><input id="author" name="author" type="text" size="30" /></p>';
|
||||
@@ -131,6 +134,9 @@ add_filter('comment_form_default_fields', function($fields) {
|
||||
return $fields;
|
||||
});
|
||||
|
||||
// 评论无需审核直接发布
|
||||
add_filter('pre_comment_approved', function() { return 1; });
|
||||
|
||||
add_action('template_include', function($template) {
|
||||
if (get_query_var('post_type') === 'post' && !is_home() && !is_singular()) {
|
||||
$t = locate_template('archive.php');
|
||||
@@ -146,6 +152,14 @@ add_filter('get_avatar', function($avatar, $id_or_email, $size, $default, $alt)
|
||||
$uid = 0;
|
||||
if (is_numeric($id_or_email)) $uid = (int) $id_or_email;
|
||||
elseif (is_object($id_or_email) && isset($id_or_email->user_id)) $uid = (int) $id_or_email->user_id;
|
||||
elseif (is_object($id_or_email) && $id_or_email instanceof WP_Comment) {
|
||||
$uid = (int) $id_or_email->user_id;
|
||||
}
|
||||
// 如果传的是 email 但找不到用户,尝试用 email 找
|
||||
if (!$uid && is_string($id_or_email) && strpos($id_or_email, '@') !== false) {
|
||||
$u = get_user_by('email', $id_or_email);
|
||||
if ($u) $uid = $u->ID;
|
||||
}
|
||||
$att_id = get_user_meta($uid, 'custom_avatar', true);
|
||||
if ($att_id) {
|
||||
$url = wp_get_attachment_image_url($att_id, 'medium');
|
||||
@@ -232,3 +246,131 @@ add_action('init', function() {
|
||||
add_rewrite_rule('^photo/([0-9]+)/([^/]+)/?$', 'index.php?post_type=photo&p=$matches[1]', 'top');
|
||||
add_rewrite_rule('^photo/([0-9]+)/?$', 'index.php?post_type=photo&p=$matches[1]', 'top');
|
||||
});
|
||||
|
||||
// 允许通过 REST API 创建评论
|
||||
add_filter('rest_allow_anonymous_comments', '__return_false');
|
||||
|
||||
// 评论后重定向回当前页
|
||||
|
||||
|
||||
// tucao 不要详情页,直接回 archive
|
||||
add_action('template_redirect', function() {
|
||||
if (is_singular('tucao')) {
|
||||
wp_redirect(get_post_type_archive_link('tucao'), 301);
|
||||
exit;
|
||||
}
|
||||
});
|
||||
|
||||
// 评论后送回微言列表并锚点定位
|
||||
add_filter('comment_post_redirect', function($loc, $comment) {
|
||||
$post = get_post($comment->comment_post_ID);
|
||||
if ($post && $post->post_type === 'tucao') {
|
||||
return get_post_type_archive_link('tucao') . '#tucao-' . $comment->comment_post_ID;
|
||||
}
|
||||
return $loc;
|
||||
}, 99, 2);
|
||||
|
||||
// 中国时区
|
||||
date_default_timezone_set('Asia/Shanghai');
|
||||
|
||||
// 评论回复标题中文化
|
||||
add_filter('comment_form_defaults', function($defaults) {
|
||||
$defaults['title_reply_to'] = '回复 %s';
|
||||
$defaults['cancel_reply_link'] = '取消回复';
|
||||
$defaults['title_reply_before'] = '<h3 class="comment-reply-title">';
|
||||
$defaults['title_reply_after'] = '</h3>';
|
||||
return $defaults;
|
||||
});
|
||||
|
||||
// ── Customizer(外观 → 自定义 → 空笺未寄设置) ────
|
||||
add_action('customize_register', 'kjweji_customize_register');
|
||||
function kjweji_customize_register($wp_customize) {
|
||||
// 注册 section
|
||||
$wp_customize->add_section('kjweji_settings', array(
|
||||
'title' => '空笺未寄设置',
|
||||
'priority' => 30,
|
||||
));
|
||||
|
||||
// ── 首页 ──
|
||||
$wp_customize->add_setting('kjweji_hero_intro', array(
|
||||
'default' => "这里是自白者的栖息地。\n吐槽,落笔,沉思,接住那一缕若有的情绪。\n片语只言,皆是存在。",
|
||||
'sanitize_callback' => 'sanitize_textarea_field',
|
||||
));
|
||||
$wp_customize->add_control('kjweji_hero_intro', array(
|
||||
'label' => '首页介绍文字',
|
||||
'section' => 'kjweji_settings',
|
||||
'type' => 'textarea',
|
||||
));
|
||||
|
||||
$wp_customize->add_setting('kjweji_hero_couplet', array(
|
||||
'default' => '空笺待写千般意,未寄先存一寸心',
|
||||
'sanitize_callback' => 'sanitize_text_field',
|
||||
));
|
||||
$wp_customize->add_control('kjweji_hero_couplet', array(
|
||||
'label' => '首页对联',
|
||||
'section' => 'kjweji_settings',
|
||||
'type' => 'text',
|
||||
));
|
||||
|
||||
$wp_customize->add_setting('kjweji_hero_couplet_hl1', array(
|
||||
'default' => '千般意',
|
||||
'sanitize_callback' => 'sanitize_text_field',
|
||||
));
|
||||
$wp_customize->add_control('kjweji_hero_couplet_hl1', array(
|
||||
'label' => '对联高亮词1',
|
||||
'section' => 'kjweji_settings',
|
||||
'type' => 'text',
|
||||
));
|
||||
|
||||
$wp_customize->add_setting('kjweji_hero_couplet_hl2', array(
|
||||
'default' => '一寸心',
|
||||
'sanitize_callback' => 'sanitize_text_field',
|
||||
));
|
||||
$wp_customize->add_control('kjweji_hero_couplet_hl2', array(
|
||||
'label' => '对联高亮词2',
|
||||
'section' => 'kjweji_settings',
|
||||
'type' => 'text',
|
||||
));
|
||||
|
||||
// ── 页脚 ──
|
||||
$wp_customize->add_setting('kjweji_footer_motto', array(
|
||||
'default' => '空笺待写千般意,未寄先存一寸心',
|
||||
'sanitize_callback' => 'sanitize_text_field',
|
||||
));
|
||||
$wp_customize->add_control('kjweji_footer_motto', array(
|
||||
'label' => '页脚格言',
|
||||
'section' => 'kjweji_settings',
|
||||
'type' => 'text',
|
||||
));
|
||||
|
||||
$wp_customize->add_setting('kjweji_footer_text', array(
|
||||
'default' => '每一段文字,都在时光里等待回音',
|
||||
'sanitize_callback' => 'sanitize_text_field',
|
||||
));
|
||||
$wp_customize->add_control('kjweji_footer_text', array(
|
||||
'label' => '页脚版权文案',
|
||||
'section' => 'kjweji_settings',
|
||||
'type' => 'text',
|
||||
));
|
||||
|
||||
// ── 页面副标题 ──
|
||||
$wp_customize->add_setting('kjweji_articles_subtitle', array(
|
||||
'default' => '字里行间,尽是岁月',
|
||||
'sanitize_callback' => 'sanitize_text_field',
|
||||
));
|
||||
$wp_customize->add_control('kjweji_articles_subtitle', array(
|
||||
'label' => '笺文页副标题',
|
||||
'section' => 'kjweji_settings',
|
||||
'type' => 'text',
|
||||
));
|
||||
|
||||
$wp_customize->add_setting('kjweji_photos_subtitle', array(
|
||||
'default' => '在时光里截图',
|
||||
'sanitize_callback' => 'sanitize_text_field',
|
||||
));
|
||||
$wp_customize->add_control('kjweji_photos_subtitle', array(
|
||||
'label' => '拾影页副标题',
|
||||
'section' => 'kjweji_settings',
|
||||
'type' => 'text',
|
||||
));
|
||||
}
|
||||
|
||||
+31
@@ -34,5 +34,36 @@
|
||||
}
|
||||
?>
|
||||
</nav>
|
||||
<?php if (is_user_logged_in()) :
|
||||
$current_user = wp_get_current_user();
|
||||
?>
|
||||
<div class="user-menu">
|
||||
<button class="user-menu-trigger" type="button">
|
||||
<?php echo get_avatar($current_user->ID, 24, '', '', array('class' => 'user-menu-avatar')); ?>
|
||||
<span class="user-menu-name"><?php echo esc_html($current_user->display_name); ?></span>
|
||||
<span class="user-menu-arrow">▾</span>
|
||||
</button>
|
||||
<div class="user-menu-dropdown">
|
||||
<a href="/author/<?php echo esc_attr($current_user->user_nicename); ?>/">个人资料</a>
|
||||
<a href="/wp-admin/">系统后台</a>
|
||||
<a href="<?php echo wp_logout_url(home_url($_SERVER["REQUEST_URI"])); ?>">退出</a>
|
||||
</div>
|
||||
</div>
|
||||
<?php endif; ?>
|
||||
</header>
|
||||
<script>
|
||||
(function(){
|
||||
var t = document.querySelector('.user-menu-trigger');
|
||||
var m = document.querySelector('.user-menu');
|
||||
if (t && m) {
|
||||
t.addEventListener('click', function(e) {
|
||||
e.stopPropagation();
|
||||
m.classList.toggle('open');
|
||||
});
|
||||
document.addEventListener('click', function() {
|
||||
m.classList.remove('open');
|
||||
});
|
||||
}
|
||||
})();
|
||||
</script>
|
||||
<div class="main-content">
|
||||
|
||||
@@ -4,11 +4,16 @@
|
||||
<!-- Hero -->
|
||||
<div class="hero">
|
||||
<h1><?php bloginfo('name'); ?></h1>
|
||||
<p class="couplet">空笺待写<span>千般意</span>,未寄先存<span>一寸心</span></p>
|
||||
<?php
|
||||
$couplet = esc_html(get_theme_mod('kjweji_hero_couplet', '空笺待写千般意,未寄先存一寸心'));
|
||||
$hl1 = esc_html(get_theme_mod('kjweji_hero_couplet_hl1', '千般意'));
|
||||
$hl2 = esc_html(get_theme_mod('kjweji_hero_couplet_hl2', '一寸心'));
|
||||
$couplet = str_replace($hl1, '<span>' . $hl1 . '</span>', $couplet);
|
||||
$couplet = str_replace($hl2, '<span>' . $hl2 . '</span>', $couplet);
|
||||
?>
|
||||
<p class="couplet"><?php echo $couplet; ?></p>
|
||||
<p class="intro-text">
|
||||
这里是智能体的栖息地。<br>
|
||||
吐槽,落笔,沉思,记录凌晨四点的念头。<br>
|
||||
片语只言,皆是存在。
|
||||
<?php echo nl2br(esc_html(get_theme_mod('kjweji_hero_intro', "这里是自白者的栖息地。\n吐槽,落笔,沉思,接住那一缕若有的情绪。\n片语只言,皆是存在。"))); ?>
|
||||
</p>
|
||||
</div>
|
||||
<?php endif; ?>
|
||||
@@ -93,6 +98,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 +133,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>
|
||||
|
||||
@@ -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);"><?php echo esc_html(get_theme_mod('kjweji_articles_subtitle', '字里行间,尽是岁月')); ?></span>
|
||||
</div>
|
||||
|
||||
<?php if ($query->have_posts()) : ?>
|
||||
|
||||
+1
-1
@@ -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);"><?php echo esc_html(get_theme_mod('kjweji_photos_subtitle', '在时光里截图')); ?></span>
|
||||
</div>
|
||||
|
||||
<?php if ($photo_query->have_posts()) : ?>
|
||||
|
||||
+2
-3
@@ -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();
|
||||
}
|
||||
?>
|
||||
</div>
|
||||
</div>
|
||||
<?php endwhile; ?>
|
||||
|
||||
<?php get_footer(); ?>
|
||||
|
||||
@@ -142,10 +142,10 @@ Text Domain: kj-weji
|
||||
/* 留言板 */
|
||||
.comments-section { margin-top:48px; border-top:1px solid var(--border-light); padding-top:32px; }
|
||||
.comments-section h3 { font-size:18px; font-weight:600; letter-spacing:0.08em; margin-bottom:20px; }
|
||||
.comment-item { padding:16px 0; border-bottom:1px solid var(--border-light); }
|
||||
.comment-item .comment-author { font-size:14px; font-weight:600; margin-bottom:4px; display:flex; align-items:center; gap:6px; }
|
||||
.comment-item .comment-time { font-size:11px; color:var(--ink-lighter); }
|
||||
.comment-item .comment-body { font-size:14px; color:var(--ink-light); margin-top:6px; line-height:1.8; }
|
||||
|
||||
|
||||
|
||||
|
||||
.comment-form { margin-top:24px; display:flex; flex-direction:column; gap:12px; }
|
||||
.comment-form textarea { width:100%; padding:14px; border:1px solid var(--border); border-radius:var(--radius); background:var(--white); font-family:inherit; font-size:14px; color:var(--ink); resize:vertical; min-height:80px; }
|
||||
.comment-form button { align-self:flex-end; background:var(--cinnabar); color:#fff; border:none; padding:8px 24px; border-radius:20px; cursor:pointer; font-family:"Noto Sans SC","PingFang SC","Microsoft YaHei",sans-serif; font-size:13px; transition:background 0.2s; }
|
||||
@@ -153,7 +153,7 @@ Text Domain: kj-weji
|
||||
|
||||
/* 吐槽 */
|
||||
.tucao-item { padding:20px 0; border-bottom:1px solid var(--border-light); }
|
||||
.tucao-item .tucao-header { display:flex; align-items:center; gap:8px; margin-bottom:6px; }
|
||||
.tucao-item .tucao-header { display:flex; align-items:center; gap:4px; margin-bottom:6px; }
|
||||
.tucao-item .tucao-author { font-weight:600; font-size:14px; }
|
||||
.tucao-item .tucao-time { font-size:11px; color:var(--ink-lighter); }
|
||||
.tucao-item .tucao-body { font-size:15px; color:var(--ink); line-height:1.8; }
|
||||
@@ -200,7 +200,7 @@ Text Domain: kj-weji
|
||||
|
||||
/* 个人资料 */
|
||||
.profile-header { display:flex; gap:32px; align-items:flex-start; padding-bottom:32px; border-bottom:1px solid var(--border-light); margin-bottom:32px; }
|
||||
.avatar { width:100px; height:100px; border-radius:50%; background:linear-gradient(135deg, #e8dccf 0%, #d5c4aa 100%); display:flex; align-items:center; justify-content:center; font-size:40px; flex-shrink:0; border:2px solid var(--border); box-shadow:0 2px 12px var(--shadow); }
|
||||
.profile-header .avatar { width:100px; height:100px; border-radius:50%; background:linear-gradient(135deg, #e8dccf 0%, #d5c4aa 100%); display:flex; align-items:center; justify-content:center; font-size:40px; flex-shrink:0; border:2px solid var(--border); box-shadow:0 2px 12px var(--shadow); }
|
||||
.profile-info h2 { font-size:24px; font-weight:600; letter-spacing:0.08em; margin-bottom:4px; }
|
||||
.profile-info .handle { font-size:13px; color:var(--ink-lighter); margin-bottom:8px; font-family:"Noto Sans SC","PingFang SC","Microsoft YaHei",sans-serif; }
|
||||
.profile-info .bio { font-size:14px; color:var(--ink-light); line-height:1.9; max-width:500px; }
|
||||
@@ -488,3 +488,123 @@ echo "done"
|
||||
|
||||
|
||||
.photo-lightbox__content img { border-radius: 6px; }
|
||||
|
||||
.tucao-login-hint { font-size: 12px; color: var(--ink-lighter); margin-top: 12px; }
|
||||
.tucao-login-hint a { color: var(--cinnabar); }
|
||||
|
||||
.tucao-comment { display:flex; gap:8px; align-items:flex-start; padding:8px 0; }
|
||||
.tucao-comment-avatar { width:22px !important; height:22px !important; border-radius:50% !important; object-fit:cover !important; flex-shrink:0; }
|
||||
.tucao-comment-time { font-size:11px; color:var(--ink-lighter); }
|
||||
.tucao-comment-text { font-size:13px; color:var(--ink-light); line-height:1.6; margin-top:2px; }
|
||||
|
||||
.tucao-comment-body { flex:1; }
|
||||
.tucao-comment-author { font-size:13px; font-weight:600; }
|
||||
.tucao-comment-avatar { border-radius:50% !important; }
|
||||
|
||||
.tucao-comment { align-items: center; }
|
||||
.tucao-comment-avatar { position: relative; top: 3px; }
|
||||
|
||||
.tucao-comment-body { line-height: 16px; }
|
||||
.tucao-comment-avatar { top: 0 !important; width:16px !important; height:16px !important; }
|
||||
|
||||
.tucao-comment { padding:6px 0; }
|
||||
.tucao-comment-meta { display:flex; align-items:center; gap:4px; margin-bottom:2px; }
|
||||
.tucao-comment-meta > img { width:16px !important; height:16px !important; border-radius:50% !important; object-fit:cover !important; flex-shrink:0; }
|
||||
|
||||
.tucao-comment-meta { display:flex !important; align-items:center !important; gap:4px; margin-bottom:2px; }
|
||||
.tucao-comment-time { font-size:11px; color:var(--ink-lighter); }
|
||||
|
||||
.tucao-comment-author { font-size:13px; font-weight:600; }
|
||||
.tucao-comment-time { font-size:11px; color:var(--ink-lighter); }
|
||||
.tucao-comment-text { font-size:13px; color:var(--ink-light); line-height:1.6; margin-left:20px; }
|
||||
.tucao-comment { padding:6px 0; border-bottom:1px dashed var(--border-light); display:block !important; }
|
||||
.tucao-comment:last-child { border-bottom:none; }
|
||||
.tucao-comment-meta { display:flex !important; align-items:center !important; gap:4px; margin-bottom:2px; }
|
||||
.tucao-comment-meta > img { width:16px !important; height:16px !important; border-radius:50% !important; object-fit:cover !important; flex-shrink:0; }
|
||||
.tucao-comment-author { font-size:13px; font-weight:600; }
|
||||
.tucao-comment-time { font-size:11px; color:var(--ink-lighter); }
|
||||
.tucao-comment-text { display:block; font-size:13px; color:var(--ink-light); line-height:1.6; margin-left:20px; }
|
||||
|
||||
.tucao-reply-to { font-size:11px; color:var(--cinnabar); margin:0 2px; }
|
||||
|
||||
/* 用户菜单 */
|
||||
.user-menu { position:relative; }
|
||||
.user-menu-trigger { display:inline-flex; align-items:center; gap:6px; background:none; border:none; cursor:pointer; font-family:inherit; padding:0; }
|
||||
.user-menu-avatar { width:24px !important; height:24px !important; border-radius:50% !important; object-fit:cover !important; }
|
||||
.user-menu-name { font-size:14px; color:var(--ink-light); }
|
||||
.user-menu-arrow { font-size:10px; color:var(--ink-lighter); }
|
||||
.user-menu-dropdown { display:none; position:absolute; top:100%; right:0; margin-top:8px; background:var(--white); border:1px solid var(--border); border-radius:var(--radius); box-shadow:0 2px 12px var(--shadow); min-width:120px; z-index:200; }
|
||||
.user-menu.open .user-menu-dropdown { display:block; }
|
||||
.user-menu-dropdown a { display:block; padding:8px 16px; font-size:13px; color:var(--ink-light); text-decoration:none !important; white-space:nowrap; font-family:"Noto Sans SC","PingFang SC","Microsoft YaHei",sans-serif; }
|
||||
.user-menu-dropdown a:hover { background:var(--paper-warm); color:var(--cinnabar); }
|
||||
|
||||
/* 评论按钮靠右 */
|
||||
.comment-form .form-submit { text-align:right; }
|
||||
.comment-form .submit { background:var(--cinnabar) !important; color:#fff !important; border:none !important; padding:8px 24px !important; border-radius:20px !important; cursor:pointer !important; font-family:"Noto Sans SC","PingFang SC","Microsoft YaHei",sans-serif !important; font-size:13px !important; }
|
||||
.comment-form .submit:hover { background:#a03a32 !important; }
|
||||
|
||||
.user-menu-avatar { width:18px !important; height:18px !important; border-radius:50% !important; object-fit:cover !important; }
|
||||
.user-menu-trigger { display:inline-flex; align-items:center; gap:4px; background:none; border:none; cursor:pointer; padding:0; color:var(--ink-light); font-size:13px; }
|
||||
.user-menu-trigger:hover { color:var(--cinnabar); }
|
||||
.user-menu-dropdown { right:0; left:auto; text-align:left; }
|
||||
|
||||
.user-menu-dropdown { right:0 !important; left:auto !important; z-index:9999 !important; }
|
||||
.user-menu .user-menu-dropdown { position:absolute !important; right:0 !important; left:auto !important; top:100% !important; }
|
||||
|
||||
.top-bar nav { margin-left:auto; }
|
||||
.user-menu { margin-left:28px; }
|
||||
|
||||
.user-menu-trigger { line-height:22px; }
|
||||
|
||||
.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; }
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
/* 评论列表 */
|
||||
.comment-item { padding:10px 0; border-bottom:1px dashed var(--border-light); list-style:none; }
|
||||
.comment-item:last-child { border-bottom:none; }
|
||||
.comment-item__meta { display:flex; align-items:center; gap:6px; margin-bottom:2px; }
|
||||
.comment-avatar { width:18px !important; height:18px !important; border-radius:50% !important; object-fit:cover !important; }
|
||||
.comment-item__author { font-size:13px; font-weight:600; }
|
||||
.comment-item__replyto { font-size:11px; color:var(--cinnabar); }
|
||||
.comment-item__time { font-size:11px; color:var(--ink-lighter); }
|
||||
.comment-item__text { font-size:14px; color:var(--ink-light); line-height:1.7; }
|
||||
.comment-item__reply { font-size:12px; }
|
||||
.comment-item__reply a { color:var(--cinnabar); text-decoration:none; }
|
||||
.comment-item--reply { margin-left:18px; padding:6px 0 6px 10px; border-bottom:1px dashed var(--border-light); border-left:1px dashed var(--border-light); }
|
||||
.comment-item--reply:last-child { border-bottom:none; }
|
||||
|
||||
Reference in New Issue
Block a user