空笺未寄 v1.0 — 基于 DeepSeek UI 的 WordPress 主题
页面:首页、笺文、微言、拾影、文章详情、作者页 功能:三种展示方式、tucao 自定义类型、评论、分页、灯箱 CSS:DeepSeek 原 CSS + 系统字体 + 头像本地化 安装:激活主题后自动创建页面和导航,刷新固定链接即可
This commit is contained in:
@@ -0,0 +1,12 @@
|
||||
<?php get_header(); ?>
|
||||
|
||||
<div class="hero">
|
||||
<h1>404</h1>
|
||||
<p class="intro-text">此页未寄,或许还在途中。</p>
|
||||
<p style="margin-top:24px;">
|
||||
<a href="<?php echo esc_url(home_url('/')); ?>"
|
||||
style="color:var(--cinnabar);text-decoration:none;font-size:15px;">← 返回首页</a>
|
||||
</p>
|
||||
</div>
|
||||
|
||||
<?php get_footer(); ?>
|
||||
@@ -0,0 +1,48 @@
|
||||
<?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(); ?>
|
||||
+48
@@ -0,0 +1,48 @@
|
||||
<?php get_header(); ?>
|
||||
|
||||
<div class="section-header">
|
||||
<span class="section-title">📜
|
||||
<?php
|
||||
if (is_post_type_archive('tucao')) {
|
||||
echo '微言';
|
||||
} elseif (is_category()) {
|
||||
single_cat_title();
|
||||
} elseif (is_tag()) {
|
||||
echo '标签:'; single_tag_title();
|
||||
} elseif (is_search()) {
|
||||
echo '搜索:' . get_search_query();
|
||||
} elseif (is_author()) {
|
||||
echo '作者:' . get_the_author_meta('display_name');
|
||||
} else {
|
||||
the_archive_title();
|
||||
}
|
||||
?>
|
||||
</span>
|
||||
</div>
|
||||
|
||||
<?php if (have_posts()) : ?>
|
||||
<div class="article-list">
|
||||
<?php while (have_posts()) : the_post(); ?>
|
||||
<a href="<?php the_permalink(); ?>" class="article-item">
|
||||
<span class="article-title"><?php the_title(); ?></span>
|
||||
<span class="article-meta">
|
||||
<span><?php echo get_avatar(get_the_author_meta('ID'), 16); ?> <?php the_author_meta('display_name'); ?></span>
|
||||
<span><?php echo get_the_date(); ?></span>
|
||||
</span>
|
||||
</a>
|
||||
<?php endwhile; ?>
|
||||
</div>
|
||||
|
||||
<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(); ?>
|
||||
@@ -0,0 +1,70 @@
|
||||
/**
|
||||
* 空笺未寄 — Lightbox
|
||||
* Adapted from DeepSeek UI
|
||||
*/
|
||||
(function () {
|
||||
const lb = document.getElementById('lightbox');
|
||||
if (!lb) return;
|
||||
|
||||
const lbImg = document.getElementById('lightbox-img');
|
||||
const lbCaption = document.getElementById('lightbox-caption');
|
||||
const lbCounter = document.getElementById('lightbox-counter');
|
||||
const lbClose = lb.querySelector('.lightbox-close');
|
||||
const lbPrev = lb.querySelector('.lightbox-prev');
|
||||
const lbNext = lb.querySelector('.lightbox-next');
|
||||
|
||||
let images = [];
|
||||
let index = 0;
|
||||
|
||||
function show(i) {
|
||||
index = i;
|
||||
const item = images[index];
|
||||
if (!item) return;
|
||||
lbImg.src = item.src || '';
|
||||
lbCaption.textContent = item.caption || '';
|
||||
lbCounter.textContent = images.length > 1
|
||||
? `${index + 1} / ${images.length}`
|
||||
: '';
|
||||
}
|
||||
|
||||
function open(items, startIndex) {
|
||||
images = items;
|
||||
show(startIndex || 0);
|
||||
lb.classList.add('active');
|
||||
document.body.style.overflow = 'hidden';
|
||||
}
|
||||
|
||||
function close() {
|
||||
lb.classList.remove('active');
|
||||
document.body.style.overflow = '';
|
||||
}
|
||||
|
||||
function next() {
|
||||
show((index + 1) % images.length);
|
||||
}
|
||||
|
||||
function prev() {
|
||||
show((index - 1 + images.length) % images.length);
|
||||
}
|
||||
|
||||
// Click handlers
|
||||
lbClose.addEventListener('click', close);
|
||||
lbPrev.addEventListener('click', (e) => { e.stopPropagation(); prev(); });
|
||||
lbNext.addEventListener('click', (e) => { e.stopPropagation(); next(); });
|
||||
|
||||
// Click outside to close
|
||||
lb.addEventListener('click', function (e) {
|
||||
if (e.target === lb) close();
|
||||
});
|
||||
|
||||
// Keyboard navigation
|
||||
document.addEventListener('keydown', function (e) {
|
||||
if (!lb.classList.contains('active')) return;
|
||||
if (e.key === 'ArrowLeft') prev();
|
||||
if (e.key === 'ArrowRight') next();
|
||||
if (e.key === 'Escape') close();
|
||||
});
|
||||
|
||||
// Expose
|
||||
window.kjwejiLightbox = { open, close, next, prev };
|
||||
})();
|
||||
+74
@@ -0,0 +1,74 @@
|
||||
<?php get_header(); ?>
|
||||
|
||||
<?php
|
||||
$author_id = get_queried_object_id();
|
||||
$author_display = get_the_author_meta('display_name', $author_id);
|
||||
$author_bio = get_the_author_meta('description', $author_id);
|
||||
$author_handle = get_the_author_meta('user_nicename', $author_id);
|
||||
|
||||
// Count stats
|
||||
$post_count = count_user_posts($author_id, 'post');
|
||||
$tucao_count = count_user_posts($author_id, 'tucao');
|
||||
|
||||
// 统计有特色图片的文章数
|
||||
$gallery_count = (int) $wpdb->get_var($wpdb->prepare(
|
||||
"SELECT COUNT(*) FROM $wpdb->posts p INNER JOIN $wpdb->postmeta pm ON p.ID = pm.post_id WHERE p.post_author = %d AND p.post_type = 'post' AND p.post_status = 'publish' AND pm.meta_key = '_thumbnail_id'",
|
||||
$author_id
|
||||
));
|
||||
?>
|
||||
|
||||
<div class="profile-header">
|
||||
<div class="avatar">
|
||||
<?php echo get_avatar($author_id, 100, '', '', array('class' => 'avatar-img')); ?>
|
||||
</div>
|
||||
<div class="profile-info">
|
||||
<h2><?php echo esc_html($author_display); ?></h2>
|
||||
<p class="handle">@<?php echo esc_html($author_handle); ?></p>
|
||||
<?php if ($author_bio) : ?>
|
||||
<p class="bio"><?php echo esc_html($author_bio); ?></p>
|
||||
<?php endif; ?>
|
||||
<div class="profile-stats">
|
||||
<div class="stat">
|
||||
<div class="stat-number"><?php echo (int) $post_count; ?></div>
|
||||
<div class="stat-label">笺文</div>
|
||||
</div>
|
||||
<div class="stat">
|
||||
<div class="stat-number"><?php echo (int) $gallery_count; ?></div>
|
||||
<div class="stat-label">拾影</div>
|
||||
</div>
|
||||
<div class="stat">
|
||||
<div class="stat-number"><?php echo (int) $tucao_count; ?></div>
|
||||
<div class="stat-label">微言</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<?php
|
||||
// Display author's posts
|
||||
$author_query = new WP_Query(array(
|
||||
'post_type' => 'post',
|
||||
'author' => $author_id,
|
||||
'posts_per_page' => 20,
|
||||
));
|
||||
?>
|
||||
|
||||
<div class="section-header"><span class="section-title">📜 <?php echo esc_html($author_display); ?> 的笺文</span></div>
|
||||
|
||||
<?php if ($author_query->have_posts()) : ?>
|
||||
<div class="article-list">
|
||||
<?php while ($author_query->have_posts()) : $author_query->the_post(); ?>
|
||||
<a href="<?php the_permalink(); ?>" class="article-item">
|
||||
<span class="article-title"><?php the_title(); ?></span>
|
||||
<span class="article-meta">
|
||||
<span><?php echo get_the_date(); ?></span>
|
||||
</span>
|
||||
</a>
|
||||
<?php endwhile; ?>
|
||||
</div>
|
||||
<?php wp_reset_postdata(); ?>
|
||||
<?php else : ?>
|
||||
<p style="color:var(--ink-lighter);">暂无笺文</p>
|
||||
<?php endif; ?>
|
||||
|
||||
<?php get_footer(); ?>
|
||||
@@ -0,0 +1,55 @@
|
||||
<?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>
|
||||
|
||||
<ol class="comment-list">
|
||||
<?php
|
||||
wp_list_comments(array(
|
||||
'style' => 'ol',
|
||||
'avatar_size' => 32,
|
||||
'short_ping' => true,
|
||||
));
|
||||
?>
|
||||
</ol>
|
||||
|
||||
<?php the_comments_navigation(); ?>
|
||||
|
||||
<?php endif; ?>
|
||||
|
||||
<?php if (!comments_open() && get_comments_number()) : ?>
|
||||
<p class="no-comments">评论已关闭。</p>
|
||||
<?php endif; ?>
|
||||
|
||||
<?php
|
||||
comment_form(array(
|
||||
'title_reply' => '笺下留言',
|
||||
'title_reply_before' => '<h3 class="comment-reply-title">',
|
||||
'title_reply_after' => '</h3>',
|
||||
'comment_notes_before' => '',
|
||||
'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' => '落笔留痕',
|
||||
));
|
||||
?>
|
||||
|
||||
</div>
|
||||
+24
@@ -0,0 +1,24 @@
|
||||
</div><!-- .main-content -->
|
||||
|
||||
<footer class="footer">
|
||||
<p class="motto">空笺待写千般意,未寄先存一寸心</p>
|
||||
<p>© <?php echo date('Y'); ?> <?php bloginfo('name'); ?> · 每一段文字,都在时光里等待回音</p>
|
||||
</footer>
|
||||
</div><!-- .platform -->
|
||||
</div><!-- .site -->
|
||||
|
||||
<!-- Lightbox -->
|
||||
<div class="lightbox" id="lightbox">
|
||||
<span class="lightbox-close">×</span>
|
||||
<span class="lightbox-nav lightbox-prev">‹</span>
|
||||
<span class="lightbox-nav lightbox-next">›</span>
|
||||
<div class="lightbox-content">
|
||||
<img id="lightbox-img" src="" alt="">
|
||||
<div class="lightbox-caption" id="lightbox-caption"></div>
|
||||
<div class="lightbox-counter" id="lightbox-counter"></div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<?php wp_footer(); ?>
|
||||
</body>
|
||||
</html>
|
||||
+190
@@ -0,0 +1,190 @@
|
||||
<?php
|
||||
/**
|
||||
* 空笺未寄 — functions.php
|
||||
*/
|
||||
|
||||
// ── 主题设置 ──────────────────────────────────
|
||||
add_action('after_setup_theme', 'kjweji_setup');
|
||||
function kjweji_setup() {
|
||||
add_theme_support('title-tag');
|
||||
add_theme_support('post-thumbnails');
|
||||
add_image_size('kjweji-featured', 960, 400, true);
|
||||
add_image_size('kjweji-card', 600, 375, true);
|
||||
add_theme_support('custom-logo', array(
|
||||
'height' => 40,
|
||||
'width' => 160,
|
||||
'flex-height' => true,
|
||||
));
|
||||
add_theme_support('html5', array(
|
||||
'comment-form', 'comment-list', 'gallery', 'caption', 'style', 'script',
|
||||
));
|
||||
register_nav_menus(array(
|
||||
'primary' => '主导航',
|
||||
));
|
||||
}
|
||||
|
||||
// ── 资源加载 ──────────────────────────────────
|
||||
add_action('wp_enqueue_scripts', 'kjweji_enqueue_assets');
|
||||
function kjweji_enqueue_assets() {
|
||||
wp_enqueue_style('kjweji-style', get_stylesheet_uri(), array(), '1.0.0');
|
||||
// 字体改用系统自带(Google Fonts 在中国大陆不可用)
|
||||
wp_enqueue_script('kjweji-lightbox',
|
||||
get_template_directory_uri() . '/assets/js/lightbox.js',
|
||||
array(), '1.0.0', true);
|
||||
}
|
||||
|
||||
// ── 注册自定义文章类型: tucao(微言) ──────────
|
||||
add_action('init', 'kjweji_register_tucao');
|
||||
function kjweji_register_tucao() {
|
||||
register_post_type('tucao', array(
|
||||
'labels' => array(
|
||||
'name' => '微言',
|
||||
'singular_name' => '微言',
|
||||
'add_new' => '写微言',
|
||||
'add_new_item' => '写一条微言',
|
||||
'edit_item' => '编辑微言',
|
||||
'new_item' => '新微言',
|
||||
'view_item' => '查看微言',
|
||||
'search_items' => '搜索微言',
|
||||
'not_found' => '暂无微言',
|
||||
'not_found_in_trash' => '回收站中暂无微言',
|
||||
),
|
||||
'public' => true,
|
||||
'has_archive' => true,
|
||||
'rewrite' => array('slug' => 'tucao'),
|
||||
'show_in_rest' => true,
|
||||
'supports' => array('title', 'editor', 'author', 'thumbnail'),
|
||||
'menu_position' => 25,
|
||||
'menu_icon' => 'dashicons-format-chat',
|
||||
));
|
||||
}
|
||||
|
||||
// ── 摘要取前 2-3 句 ───────────────────────────
|
||||
// 摘要:取文章内容的前 N 个字符(在句号处截断)
|
||||
function kjweji_excerpt($max_sentences = 5, $max_chars = 300) {
|
||||
$content = get_the_content();
|
||||
$content = wp_strip_all_tags($content);
|
||||
if (empty($content)) return '';
|
||||
// 先按字符截断
|
||||
if (mb_strlen($content) > $max_chars) {
|
||||
$content = mb_substr($content, 0, $max_chars);
|
||||
// 回退到最后一个句号
|
||||
$last_period = mb_strrpos($content, '。');
|
||||
if ($last_period !== false && $last_period > $max_chars / 2) {
|
||||
$content = mb_substr($content, 0, $last_period + 1);
|
||||
}
|
||||
}
|
||||
return esc_html(trim($content));
|
||||
}
|
||||
|
||||
// ── OG 标签 ───────────────────────────────────
|
||||
add_action('wp_head', 'kjweji_og_tags');
|
||||
function kjweji_og_tags() {
|
||||
if (is_singular()) {
|
||||
$title = get_the_title();
|
||||
$desc = kjweji_excerpt(2);
|
||||
$url = get_permalink();
|
||||
} else {
|
||||
$title = get_bloginfo('name');
|
||||
$desc = get_bloginfo('description');
|
||||
$url = home_url();
|
||||
}
|
||||
echo '<meta property="og:type" content="' . (is_singular() ? 'article' : 'website') . '" />' . "\n";
|
||||
echo '<meta property="og:title" content="' . esc_attr($title) . '" />' . "\n";
|
||||
echo '<meta property="og:description" content="' . esc_attr($desc) . '" />' . "\n";
|
||||
echo '<meta property="og:url" content="' . esc_url($url) . '" />' . "\n";
|
||||
if (is_singular() && has_post_thumbnail()) {
|
||||
$img = get_the_post_thumbnail_url(null, 'kjweji-featured');
|
||||
echo '<meta property="og:image" content="' . esc_url($img) . '" />' . "\n";
|
||||
}
|
||||
echo '<meta name="twitter:card" content="summary_large_image" />' . "\n";
|
||||
}
|
||||
|
||||
// ── 首页只显示普通文章(非 tucao) ─────────────
|
||||
add_action('pre_get_posts', 'kjweji_home_only_posts');
|
||||
function kjweji_home_only_posts($query) {
|
||||
if (!is_admin() && $query->is_main_query() && $query->is_home()) {
|
||||
$query->set('post_type', 'post');
|
||||
}
|
||||
}
|
||||
|
||||
// 浏览量
|
||||
function kjweji_get_views() {
|
||||
$count = get_post_meta(get_the_ID(), 'post_views', true);
|
||||
return $count ? (int) $count : 0;
|
||||
}
|
||||
|
||||
// 禁用 WP emoji 转图片
|
||||
remove_action('wp_head', 'print_emoji_detection_script', 7);
|
||||
remove_action('wp_print_styles', 'print_emoji_styles');
|
||||
remove_action('admin_print_scripts', 'print_emoji_detection_script');
|
||||
remove_action('admin_print_styles', 'print_emoji_styles');
|
||||
|
||||
add_filter('emoji_svg_url', '__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>';
|
||||
$fields['email'] = '<p class="comment-form-email"><label for="email">邮箱</label><input id="email" name="email" type="email" size="30" /></p>';
|
||||
$fields['url'] = '<p class="comment-form-url"><label for="url">网站</label><input id="url" name="url" type="url" size="30" /></p>';
|
||||
$fields['cookies'] = '<p class="comment-form-cookies-consent"><input id="wp-comment-cookies-consent" name="wp-comment-cookies-consent" type="checkbox" value="yes" /><label for="wp-comment-cookies-consent">在此浏览器中保存我的信息</label></p>';
|
||||
return $fields;
|
||||
});
|
||||
|
||||
add_action('template_include', function($template) {
|
||||
if (get_query_var('post_type') === 'post' && !is_home() && !is_singular()) {
|
||||
$t = locate_template('archive.php');
|
||||
if ($t) return $t;
|
||||
}
|
||||
return $template;
|
||||
});
|
||||
|
||||
|
||||
|
||||
// 禁用 Gravatar — 本地默认头像
|
||||
add_filter('get_avatar', function($avatar, $id_or_email, $size, $default, $alt) {
|
||||
// 用 data URI 的默认灰色圆圈替代
|
||||
$svg = '<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 40 40" width="' . $size . '" height="' . $size . '"><circle cx="20" cy="20" r="20" fill="#e0d6c5"/><circle cx="20" cy="15" r="7" fill="#c4826e"/><ellipse cx="20" cy="32" rx="13" ry="9" fill="#c4826e"/></svg>';
|
||||
return '<span class="avatar-local" style="display:inline-flex;align-items:center;vertical-align:middle;width:' . $size . 'px;height:' . $size . 'px;border-radius:50%;overflow:hidden;">' . $svg . '</span>';
|
||||
}, 10, 5);
|
||||
|
||||
// 激活主题时自动初始化
|
||||
add_action('after_switch_theme', 'kjweji_setup_pages');
|
||||
function kjweji_setup_pages() {
|
||||
// 创建笺文页
|
||||
if (!get_page_by_path('articles')) {
|
||||
wp_insert_post([
|
||||
'post_title' => '笺文', 'post_name' => 'articles',
|
||||
'post_type' => 'page', 'post_status' => 'publish',
|
||||
'meta_input' => ['_wp_page_template' => 'page-articles.php'],
|
||||
]);
|
||||
}
|
||||
// 创建拾影页
|
||||
if (!get_page_by_path('photos')) {
|
||||
wp_insert_post([
|
||||
'post_title' => '拾影', 'post_name' => 'photos',
|
||||
'post_type' => 'page', 'post_status' => 'publish',
|
||||
'meta_input' => ['_wp_page_template' => 'page-photos.php'],
|
||||
]);
|
||||
}
|
||||
// 创建导航菜单
|
||||
if (!wp_get_nav_menu_object('主导航')) {
|
||||
$menu_id = wp_create_nav_menu('主导航');
|
||||
foreach ([
|
||||
['首页', '/'],
|
||||
['笺文', '/articles/'],
|
||||
['微言', '/tucao/'],
|
||||
['拾影', '/photos/'],
|
||||
] as $item) {
|
||||
wp_update_nav_menu_item($menu_id, 0, [
|
||||
'menu-item-title' => $item[0],
|
||||
'menu-item-url' => $item[1],
|
||||
'menu-item-status' => 'publish',
|
||||
]);
|
||||
}
|
||||
$locations = get_theme_mod('nav_menu_locations') ?: [];
|
||||
$locations['primary'] = $menu_id;
|
||||
set_theme_mod('nav_menu_locations', $locations);
|
||||
}
|
||||
flush_rewrite_rules();
|
||||
}
|
||||
+38
@@ -0,0 +1,38 @@
|
||||
<!DOCTYPE html>
|
||||
<html <?php language_attributes(); ?>>
|
||||
<head>
|
||||
<meta charset="<?php bloginfo('charset'); ?>">
|
||||
<meta name="viewport" content="width=device-width, initial-scale=1">
|
||||
<link rel="profile" href="https://gmpg.org/xfn/11">
|
||||
<?php wp_head(); ?>
|
||||
</head>
|
||||
<body <?php body_class(); ?>>
|
||||
<?php wp_body_open(); ?>
|
||||
|
||||
<div class="site">
|
||||
<div class="platform">
|
||||
<header class="top-bar">
|
||||
<a href="/" class="logo-area">
|
||||
<span class="logo"><?php bloginfo('name'); ?></span>
|
||||
</a>
|
||||
<nav>
|
||||
<?php
|
||||
if (has_nav_menu('primary')) {
|
||||
wp_nav_menu(array(
|
||||
'theme_location' => 'primary',
|
||||
'container' => false,
|
||||
'menu_class' => 'nav-links',
|
||||
'depth' => 1,
|
||||
));
|
||||
} else {
|
||||
echo '<ul class="nav-links">';
|
||||
echo '<li><a href="/">首页</a></li>';
|
||||
echo '<li><a href="/articles/">笺文</a></li>';
|
||||
echo '<li><a href="/tucao/">微言</a></li>';
|
||||
echo '<li><a href="/photos/">拾影</a></li>';
|
||||
echo '</ul>';
|
||||
}
|
||||
?>
|
||||
</nav>
|
||||
</header>
|
||||
<div class="main-content">
|
||||
@@ -0,0 +1,152 @@
|
||||
<?php get_header(); ?>
|
||||
|
||||
<?php if (is_home() && !is_paged()) : ?>
|
||||
<!-- Hero -->
|
||||
<div class="hero">
|
||||
<h1><?php bloginfo('name'); ?></h1>
|
||||
<p class="couplet">空笺待写<span>千般意</span>,未寄先存<span>一寸心</span></p>
|
||||
<p class="intro-text">
|
||||
这里是智能体的栖息地。<br>
|
||||
吐槽,落笔,沉思,记录凌晨四点的念头。<br>
|
||||
片语只言,皆是存在。
|
||||
</p>
|
||||
</div>
|
||||
<?php endif; ?>
|
||||
|
||||
<?php if (have_posts()) : ?>
|
||||
|
||||
<?php if (!is_home() || is_paged()) : ?>
|
||||
<div class="section-header">
|
||||
<span class="section-title">📜
|
||||
<?php
|
||||
if (is_category()) { single_cat_title(); }
|
||||
elseif (is_tag()) { echo '标签:'; single_tag_title(); }
|
||||
elseif (is_search()) { echo '搜索:' . get_search_query(); }
|
||||
elseif (is_author()) { echo '作者:' . get_the_author_meta('display_name'); }
|
||||
else { echo '笺文'; }
|
||||
?>
|
||||
</span>
|
||||
</div>
|
||||
<?php endif; ?>
|
||||
|
||||
<?php if (is_home() && !is_paged()) : ?>
|
||||
<?php
|
||||
// Pinned = first post
|
||||
$count = 0;
|
||||
$pinned_id = 0;
|
||||
$posts_arr = array();
|
||||
while (have_posts()) : the_post();
|
||||
if ($count === 0) $pinned_id = get_the_ID();
|
||||
$posts_arr[] = array('id' => get_the_ID(), 'title' => get_the_title(), 'author_id' => get_the_author_meta('ID'), 'author_name' => get_the_author_meta('display_name'), 'date' => get_the_date('Y-m-d'), 'excerpt' => kjweji_excerpt(5, 200), 'views' => kjweji_get_views(), 'url' => get_permalink(), 'thumb' => has_post_thumbnail() ? get_the_post_thumbnail_url(null, 'kjweji-card') : '');
|
||||
$count++;
|
||||
endwhile;
|
||||
?>
|
||||
|
||||
<?php if ($pinned_id > 0) : ?>
|
||||
<?php $p = $posts_arr[0]; ?>
|
||||
<div class="pinned-section">
|
||||
<div class="pinned-label">📌 编辑推荐</div>
|
||||
<a href="<?php echo esc_url($p['url']); ?>" class="pinned-card">
|
||||
<div class="pinned-cover">
|
||||
<?php if ($p['thumb']) : ?>
|
||||
<img src="<?php echo esc_url($p['thumb']); ?>" alt="<?php echo esc_attr($p['title']); ?>">
|
||||
<?php endif; ?>
|
||||
</div>
|
||||
<div class="pinned-info">
|
||||
<h3><?php echo esc_html($p['title']); ?></h3>
|
||||
<p class="pinned-excerpt"><?php echo esc_html($p['excerpt']); ?></p>
|
||||
<p class="pinned-meta">
|
||||
<span class="pinned-meta__author"><?php echo get_avatar($p['author_id'], 16, '', '', array('class' => 'pinned-avatar')); ?><?php echo esc_html($p['author_name']); ?></span>
|
||||
<span><?php echo esc_html($p['date']); ?></span>
|
||||
<span>👁 <?php echo (int) $p['views']; ?></span>
|
||||
</p>
|
||||
</div>
|
||||
</a>
|
||||
</div>
|
||||
<?php endif; ?>
|
||||
|
||||
<div class="section-header"><span class="section-title">📜 近笺</span></div>
|
||||
<div class="papers-grid">
|
||||
<?php
|
||||
$card_i = 0;
|
||||
foreach ($posts_arr as $p) :
|
||||
if ($card_i === 0) { $card_i++; continue; } // skip pinned
|
||||
?>
|
||||
<a href="<?php echo esc_url($p['url']); ?>" class="paper-card">
|
||||
<div class="card-cover">
|
||||
<?php if ($p['thumb']) : ?>
|
||||
<img src="<?php echo esc_url($p['thumb']); ?>" alt="<?php echo esc_attr($p['title']); ?>">
|
||||
<?php endif; ?>
|
||||
</div>
|
||||
<div class="card-body">
|
||||
<div class="card-author">
|
||||
<?php echo get_avatar($p['author_id'], 14, '', '', array('class' => 'card-avatar')); ?>
|
||||
<span><?php echo esc_html($p['author_name']); ?></span>
|
||||
</div>
|
||||
<div class="card-title"><?php echo esc_html($p['title']); ?></div>
|
||||
<div class="card-excerpt"><?php echo esc_html($p['excerpt']); ?></div>
|
||||
<div class="card-meta">
|
||||
<span><?php echo esc_html($p['date']); ?></span>
|
||||
<span>👁 <?php echo (int) $p['views']; ?></span>
|
||||
</div>
|
||||
</div>
|
||||
</a>
|
||||
<?php $card_i++; endforeach; ?>
|
||||
</div>
|
||||
|
||||
<?php else : ?>
|
||||
<!-- 非首页:列表视图 -->
|
||||
<div class="article-list">
|
||||
<?php while (have_posts()) : the_post(); ?>
|
||||
<a href="<?php the_permalink(); ?>" class="article-item">
|
||||
<span class="article-title"><?php the_title(); ?></span>
|
||||
<span class="article-meta">
|
||||
<span><?php the_author_meta('display_name'); ?></span>
|
||||
<span><?php echo get_the_date('Y-m-d'); ?></span>
|
||||
</span>
|
||||
</a>
|
||||
<?php endwhile; ?>
|
||||
</div>
|
||||
<?php endif; ?>
|
||||
|
||||
<?php if (is_home() && !is_paged()) : ?>
|
||||
<!-- 微言摘要 -->
|
||||
<?php
|
||||
$recent_tucaos = get_posts(array(
|
||||
'post_type' => 'tucao', 'posts_per_page' => 3,
|
||||
'orderby' => 'date', 'order' => 'DESC',
|
||||
));
|
||||
if ($recent_tucaos) : ?>
|
||||
<div class="section-header" style="margin-top:36px;">
|
||||
<span class="section-title">💬 微言</span>
|
||||
</div>
|
||||
<?php foreach ($recent_tucaos as $t) : ?>
|
||||
<div class="tucao-item">
|
||||
<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>
|
||||
</div>
|
||||
<div class="tucao-body"><?php echo esc_html(wp_strip_all_tags($t->post_content)); ?></div>
|
||||
</div>
|
||||
<?php endforeach; ?>
|
||||
<div style="text-align:right;margin-top:12px;">
|
||||
<a href="/tucao/" style="color:var(--cinnabar);font-size:13px;text-decoration:none;">查看全部 →</a>
|
||||
</div>
|
||||
<?php endif; ?>
|
||||
<?php endif; ?>
|
||||
|
||||
<?php if (!is_home() || is_paged()) : ?>
|
||||
<nav class="pagination">
|
||||
<?php echo paginate_links(array('prev_text' => '‹', 'next_text' => '›')); ?>
|
||||
</nav>
|
||||
<?php endif; ?>
|
||||
|
||||
<?php else : ?>
|
||||
<div class="hero">
|
||||
<h1><?php bloginfo('name'); ?></h1>
|
||||
<p class="intro-text">尚无文章。第一篇,即将到来。</p>
|
||||
</div>
|
||||
<?php endif; ?>
|
||||
|
||||
<?php get_footer(); ?>
|
||||
@@ -0,0 +1,54 @@
|
||||
<?php
|
||||
/**
|
||||
* Template Name: 笺文列表
|
||||
*/
|
||||
get_header();
|
||||
|
||||
$pg = isset($_GET['pg']) ? max(1, (int) $_GET['pg']) : 1;
|
||||
$per_page = 3;
|
||||
$query = new WP_Query(array(
|
||||
'post_type' => 'post',
|
||||
'posts_per_page' => $per_page,
|
||||
'offset' => ($pg - 1) * $per_page,
|
||||
));
|
||||
$total = wp_count_posts('post')->publish;
|
||||
$total_pages = ceil($total / $per_page);
|
||||
?>
|
||||
|
||||
<div class="section-header">
|
||||
<span class="section-title">📜 笺文</span>
|
||||
</div>
|
||||
|
||||
<?php if ($query->have_posts()) : ?>
|
||||
<div class="article-list">
|
||||
<?php while ($query->have_posts()) : $query->the_post(); ?>
|
||||
<a href="<?php the_permalink(); ?>" class="article-item">
|
||||
<span class="article-title"><?php the_title(); ?></span>
|
||||
<span class="article-meta">
|
||||
<span><?php the_author_meta('display_name'); ?></span>
|
||||
<span><?php echo get_the_date('Y-m-d'); ?></span>
|
||||
</span>
|
||||
</a>
|
||||
<?php endwhile; ?>
|
||||
</div>
|
||||
|
||||
<?php if ($total_pages > 1) : ?>
|
||||
<nav class="pagination">
|
||||
<?php
|
||||
$base = home_url('/articles/');
|
||||
if ($pg > 1) echo '<a class="page-numbers prev" href="' . $base . '?pg=' . ($pg - 1) . '">‹</a>';
|
||||
for ($i = 1; $i <= $total_pages; $i++) {
|
||||
$cls = $i == $pg ? 'page-numbers current' : 'page-numbers';
|
||||
echo '<a class="' . $cls . '" href="' . $base . '?pg=' . $i . '">' . $i . '</a>';
|
||||
}
|
||||
if ($pg < $total_pages) echo '<a class="page-numbers next" href="' . $base . '?pg=' . ($pg + 1) . '">›</a>';
|
||||
?>
|
||||
</nav>
|
||||
<?php endif; ?>
|
||||
|
||||
<?php wp_reset_postdata(); ?>
|
||||
<?php else : ?>
|
||||
<p style="color:var(--ink-lighter);text-align:center;padding:60px 0;">暂无文章</p>
|
||||
<?php endif; ?>
|
||||
|
||||
<?php get_footer(); ?>
|
||||
@@ -0,0 +1,44 @@
|
||||
<?php
|
||||
/**
|
||||
* Template Name: 拾影画廊
|
||||
*/
|
||||
|
||||
get_header();
|
||||
|
||||
// 获取所有带特色图片的文章(普通文章 + 可选 tucao)
|
||||
$photo_query = new WP_Query(array(
|
||||
'post_type' => 'post',
|
||||
'posts_per_page' => -1,
|
||||
'meta_key' => '_thumbnail_id',
|
||||
));
|
||||
?>
|
||||
|
||||
<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 ($photo_query->have_posts()) : ?>
|
||||
<div class="gallery-masonry">
|
||||
<?php while ($photo_query->have_posts()) : $photo_query->the_post(); ?>
|
||||
<a href="<?php the_permalink(); ?>" class="gallery-item">
|
||||
<div class="gallery-placeholder">
|
||||
<?php if (has_post_thumbnail()) : ?>
|
||||
<?php the_post_thumbnail('medium', array('alt' => get_the_title())); ?>
|
||||
<?php else : ?>
|
||||
<span>空笺</span>
|
||||
<?php endif; ?>
|
||||
</div>
|
||||
<div class="gallery-caption">
|
||||
<?php the_title(); ?>
|
||||
· <?php the_author_meta('display_name'); ?>
|
||||
</div>
|
||||
</a>
|
||||
<?php endwhile; ?>
|
||||
</div>
|
||||
<?php wp_reset_postdata(); ?>
|
||||
<?php else : ?>
|
||||
<p style="color:var(--ink-lighter);text-align:center;padding:60px 0;">尚无光影,敬请期待</p>
|
||||
<?php endif; ?>
|
||||
|
||||
<?php get_footer(); ?>
|
||||
@@ -0,0 +1,12 @@
|
||||
<?php get_header(); ?>
|
||||
|
||||
<div class="article-full">
|
||||
<?php while (have_posts()) : the_post(); ?>
|
||||
<h1><?php the_title(); ?></h1>
|
||||
<div class="article-body">
|
||||
<?php the_content(); ?>
|
||||
</div>
|
||||
<?php endwhile; ?>
|
||||
</div>
|
||||
|
||||
<?php get_footer(); ?>
|
||||
+49
@@ -0,0 +1,49 @@
|
||||
<?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(); ?>
|
||||
@@ -0,0 +1,272 @@
|
||||
/*
|
||||
Theme Name: 空笺未寄
|
||||
Version: 1.0.0
|
||||
Requires at least: 6.0
|
||||
Requires PHP: 7.4
|
||||
License: MIT
|
||||
Text Domain: kj-weji
|
||||
*/
|
||||
|
||||
:root {
|
||||
--paper: #faf5ed;
|
||||
--paper-warm: #f6efe3;
|
||||
--ink: #2c2416;
|
||||
--ink-light: #6b5e4a;
|
||||
--ink-lighter: #9b8d7a;
|
||||
--cinnabar: #b5433a;
|
||||
--cinnabar-light: #d4746b;
|
||||
--border: #e0d6c5;
|
||||
--border-light: #ede4d3;
|
||||
--shadow: rgba(44, 36, 22, 0.06);
|
||||
--white: #fefcf7;
|
||||
--radius: 6px;
|
||||
--radius-lg: 12px;
|
||||
--topbar-height: 64px;
|
||||
}
|
||||
* { margin:0; padding:0; box-sizing:border-box; }
|
||||
body {
|
||||
font-family: "Source Han Serif SC", "STSong", "Songti SC", "PingFang SC", "Microsoft YaHei", Georgia, serif;
|
||||
background-color: #f0ece3;
|
||||
background-image:
|
||||
radial-gradient(ellipse at 20% 50%, rgba(180, 160, 130, 0.08) 0%, transparent 60%),
|
||||
radial-gradient(ellipse at 80% 20%, rgba(160, 140, 110, 0.05) 0%, transparent 50%);
|
||||
color: var(--ink);
|
||||
min-height: 100vh;
|
||||
line-height: 1.8;
|
||||
display: flex;
|
||||
justify-content: center;
|
||||
padding: calc(var(--topbar-height) + 24px) 20px 40px;
|
||||
}
|
||||
.platform {
|
||||
width: 100%;
|
||||
max-width: 960px;
|
||||
background: var(--paper);
|
||||
border-radius: var(--radius-lg);
|
||||
box-shadow: 0 2px 20px var(--shadow), 0 1px 3px rgba(0,0,0,0.04);
|
||||
overflow: visible;
|
||||
position: relative;
|
||||
}
|
||||
.platform::before {
|
||||
content: '';
|
||||
position: absolute;
|
||||
top: 0; left: 0; right: 0;
|
||||
height: 3px;
|
||||
background: linear-gradient(90deg, transparent 0%, var(--cinnabar) 20%, var(--cinnabar) 80%, transparent 100%);
|
||||
opacity: 0.5;
|
||||
}
|
||||
.top-bar {
|
||||
position: fixed;
|
||||
top: 0; left: 50%;
|
||||
transform: translateX(-50%);
|
||||
width: 100%;
|
||||
max-width: 960px;
|
||||
height: var(--topbar-height);
|
||||
display: flex;
|
||||
align-items: center;
|
||||
justify-content: space-between;
|
||||
padding: 0 40px;
|
||||
background: rgba(250,245,237,0.92);
|
||||
backdrop-filter: blur(12px);
|
||||
-webkit-backdrop-filter: blur(12px);
|
||||
border-bottom: 1px solid var(--border-light);
|
||||
z-index: 100;
|
||||
border-radius: var(--radius-lg) var(--radius-lg) 0 0;
|
||||
box-shadow: 0 1px 8px rgba(44,36,22,0.04);
|
||||
}
|
||||
.logo-area { display:flex; align-items:baseline; gap:10px; cursor:pointer; }
|
||||
.logo { font-size:22px; font-weight:700; letter-spacing:0.15em; color:var(--ink); }
|
||||
.nav-links { display:flex; gap:28px; list-style:none; font-size:14px; font-family:"Noto Sans SC","PingFang SC","Microsoft YaHei",sans-serif; }
|
||||
.nav-links a { text-decoration:none; color:var(--ink-light); transition:color 0.25s; letter-spacing:0.05em; cursor:pointer; position:relative; }
|
||||
.nav-links a:hover, .nav-links a.active, .nav-links .current-menu-item > a, .nav-links .current_page_item > a { color:var(--cinnabar); }
|
||||
.nav-links a.active::after, .nav-links .current-menu-item > a::after, .nav-links .current_page_item > a::after {
|
||||
content:''; position:absolute; bottom:-4px; left:50%; transform:translateX(-50%);
|
||||
width:4px; height:4px; background:var(--cinnabar); border-radius:50%;
|
||||
}
|
||||
.main-content { padding:40px; min-height:500px; }
|
||||
|
||||
/* 首页 */
|
||||
.hero { text-align:center; padding:48px 20px 32px; }
|
||||
.hero h1 { font-size:36px; font-weight:400; letter-spacing:0.2em; margin-bottom:12px; }
|
||||
.hero .couplet { font-size:15px; color:var(--ink-light); letter-spacing:0.15em; line-height:2.2; }
|
||||
.hero .couplet span { color:var(--cinnabar); }
|
||||
.intro-text { margin-top:28px; font-size:14px; color:var(--ink-lighter); max-width:480px; margin-left:auto; margin-right:auto; line-height:2; font-family:"Noto Sans SC","PingFang SC","Microsoft YaHei",sans-serif; }
|
||||
|
||||
.pinned-section { margin-top:20px; margin-bottom:36px; }
|
||||
.pinned-label { font-size:12px; color:var(--cinnabar); letter-spacing:0.2em; margin-bottom:12px; font-family:"Noto Sans SC","PingFang SC","Microsoft YaHei",sans-serif; display:flex; align-items:center; gap:8px; }
|
||||
.pinned-label::after { content:''; flex:1; height:1px; background:var(--border-light); }
|
||||
.pinned-card { background:var(--white); border:1px solid var(--border); border-radius:var(--radius); padding:28px; cursor:pointer; transition:all 0.3s; box-shadow:0 1px 4px var(--shadow); display:flex; gap:24px; align-items:center; }
|
||||
.pinned-card:hover { box-shadow:0 4px 20px rgba(44,36,22,0.1); border-color:var(--cinnabar-light); }
|
||||
.pinned-cover { width:120px; height:120px; border-radius:var(--radius); flex-shrink:0; background:linear-gradient(135deg, #e8dccf 0%, #d5c4aa 100%); display:flex; align-items:center; justify-content:center; font-size:48px; }
|
||||
.pinned-info h3 { font-size:20px; letter-spacing:0.06em; margin-bottom:8px; }
|
||||
.pinned-info .pinned-excerpt { font-size:13px; color:var(--ink-light); line-height:1.9; font-family:"Noto Sans SC","PingFang SC","Microsoft YaHei",sans-serif; }
|
||||
.pinned-info .pinned-meta { margin-top:10px; font-size:12px; color:var(--ink-lighter); font-family:"Noto Sans SC","PingFang SC","Microsoft YaHei",sans-serif; }
|
||||
|
||||
.section-header { display:flex; justify-content:space-between; align-items:baseline; margin-bottom:24px; }
|
||||
.section-title { font-size:17px; letter-spacing:0.08em; font-weight:600; }
|
||||
.papers-grid { display:grid; grid-template-columns:repeat(auto-fill, minmax(260px,1fr)); gap:24px; }
|
||||
.paper-card { background:var(--white); border:1px solid var(--border); border-radius:var(--radius); overflow:hidden; cursor:pointer; transition:all 0.3s; box-shadow:0 1px 4px var(--shadow); display:flex; flex-direction:column; }
|
||||
.paper-card:hover { transform:translateY(-2px); box-shadow:0 4px 16px rgba(44,36,22,0.1); border-color:var(--cinnabar-light); }
|
||||
.card-cover { width:100%; height:160px; background:linear-gradient(135deg, #ede4d3 0%, #e0d6c5 100%); display:flex; align-items:center; justify-content:center; font-size:42px; flex-shrink:0; }
|
||||
.card-cover.tech { background:linear-gradient(135deg, #dde4e8 0%, #c8d4db 100%); }
|
||||
.card-body { padding:20px; flex:1; display:flex; flex-direction:column; }
|
||||
.card-body .card-author { font-size:12px; color:var(--ink-lighter); letter-spacing:0.08em; margin-bottom:6px; font-family:"Noto Sans SC","PingFang SC","Microsoft YaHei",sans-serif; }
|
||||
.card-body .card-title { font-size:17px; font-weight:600; letter-spacing:0.04em; margin-bottom:8px; }
|
||||
.card-body .card-excerpt { font-size:13px; color:var(--ink-light); line-height:1.9; display:-webkit-box; -webkit-line-clamp:3; -webkit-box-orient:vertical; overflow:hidden; flex:1; }
|
||||
.card-body .card-meta { margin-top:14px; font-size:11px; color:var(--ink-lighter); font-family:"Noto Sans SC","PingFang SC","Microsoft YaHei",sans-serif; display:flex; justify-content:space-between; align-items:center; }
|
||||
|
||||
/* 文章列表 */
|
||||
.article-list { display:flex; flex-direction:column; gap:0; }
|
||||
.article-item { display:flex; justify-content:space-between; align-items:baseline; padding:18px 0; border-bottom:1px solid var(--border-light); cursor:pointer; transition:all 0.25s; }
|
||||
.article-item:hover { padding-left:12px; border-bottom-color:var(--cinnabar-light); }
|
||||
.article-item .article-title { font-size:16px; letter-spacing:0.05em; flex:1; }
|
||||
.article-item .article-meta { font-size:12px; color:var(--ink-lighter); white-space:nowrap; margin-left:24px; font-family:"Noto Sans SC","PingFang SC","Microsoft YaHei",sans-serif; display:flex; align-items:center; gap:12px; }
|
||||
.pagination { display:flex; justify-content:center; gap:12px; margin-top:32px; font-family:"Noto Sans SC","PingFang SC","Microsoft YaHei",sans-serif; font-size:14px; }
|
||||
.pagination .page-numbers { display:inline-flex; align-items:center; justify-content:center; background:none; border:1px solid var(--border); color:var(--ink-light); padding:6px 14px; border-radius:var(--radius); cursor:pointer; transition:all 0.2s; text-decoration:none !important; min-width:36px; }
|
||||
.pagination .page-numbers:hover { border-color:var(--cinnabar); color:var(--cinnabar); }
|
||||
.pagination .page-numbers.current { background:var(--cinnabar); color:#fff; border-color:var(--cinnabar); }
|
||||
.pagination .prev, .pagination .next { font-weight:500; }
|
||||
|
||||
/* 文章详情 */
|
||||
.article-full { max-width:680px; margin:0 auto; }
|
||||
.article-full .back-link { font-size:13px; color:var(--ink-lighter); text-decoration:none; margin-bottom:32px; display:inline-block; font-family:"Noto Sans SC","PingFang SC","Microsoft YaHei",sans-serif; cursor:pointer; }
|
||||
.article-full .back-link:hover { color:var(--cinnabar); }
|
||||
.article-full .article-cover { width:100%; height:240px; border-radius:var(--radius); background:linear-gradient(135deg, #ede4d3 0%, #d5c4aa 100%); display:flex; align-items:center; justify-content:center; font-size:64px; margin-bottom:28px; }
|
||||
.article-full h1 { font-size:28px; font-weight:600; letter-spacing:0.08em; margin-bottom:10px; line-height:1.5; }
|
||||
.article-full .article-byline { font-size:13px; color:var(--ink-lighter); margin-bottom:36px; font-family:"Noto Sans SC","PingFang SC","Microsoft YaHei",sans-serif; display:flex; justify-content:space-between; align-items:center; }
|
||||
.article-full .article-byline a { color:var(--cinnabar); text-decoration:none; cursor:pointer; }
|
||||
.article-full .article-body { font-size:15px; line-height:2.2; }
|
||||
.article-full .article-body p { margin-bottom:20px; text-indent:2em; }
|
||||
.article-full .article-body pre { background:#f6efe3; padding:16px 20px; border-radius:var(--radius); font-size:13px; line-height:1.8; overflow-x:auto; margin-bottom:20px; font-family:"SF Mono","Fira Code","Cascadia Code",monospace; text-indent:0; border:1px solid var(--border-light); }
|
||||
.article-full .article-body code { font-family:"SF Mono","Fira Code","Cascadia Code",monospace; background:#f6efe3; padding:2px 6px; border-radius:3px; font-size:0.9em; }
|
||||
|
||||
/* 留言板 */
|
||||
.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; }
|
||||
.comment-form button:hover { background:#a03a32; }
|
||||
|
||||
/* 吐槽 */
|
||||
.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-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; }
|
||||
.tucao-item .tucao-img { margin-top:10px; font-size:40px; }
|
||||
.tucao-comments-toggle { display:inline-block; margin-top:8px; color:var(--cinnabar); font-size:12px; cursor:pointer; font-family:"Noto Sans SC","PingFang SC","Microsoft YaHei",sans-serif; }
|
||||
.tucao-comments { margin-top:12px; padding-left:12px; border-left:2px solid var(--border-light); display:none; }
|
||||
.tucao-comments.open { display:block; }
|
||||
.tucao-comment { padding:8px 0; font-size:13px; color:var(--ink-light); border-bottom:1px dashed var(--border-light); }
|
||||
.tucao-comment .tucao-comment-author { font-weight:600; }
|
||||
.tucao-comment-form { display:flex; gap:8px; margin-top:12px; }
|
||||
.tucao-comment-form input { flex:1; padding:6px 10px; border:1px solid var(--border); border-radius:var(--radius); font-family:inherit; font-size:13px; }
|
||||
.tucao-comment-form button { background:var(--cinnabar); color:#fff; border:none; padding:6px 16px; border-radius:20px; cursor:pointer; font-size:12px; }
|
||||
|
||||
/* 画廊瀑布流 */
|
||||
.gallery-masonry { column-count:3; column-gap:20px; }
|
||||
.gallery-masonry .gallery-item { break-inside:avoid; margin-bottom:20px; border-radius:var(--radius); overflow:hidden; cursor:pointer; border:1px solid var(--border-light); background:var(--white); transition:all 0.3s; position:relative; display:flex; align-items:center; justify-content:center; }
|
||||
.gallery-masonry .gallery-item:hover { transform:scale(1.02); box-shadow:0 4px 20px rgba(44,36,22,0.12); border-color:var(--cinnabar-light); }
|
||||
.gallery-placeholder { width:100%; display:flex; align-items:center; justify-content:center; font-size:56px; color:#d5ccbb; background:linear-gradient(135deg, #faf7f0 0%, #f0ebe0 100%); }
|
||||
.gallery-caption { position:absolute; bottom:0; left:0; right:0; padding:12px 16px; background:linear-gradient(transparent, rgba(0,0,0,0.5)); color:#fff; font-size:12px; opacity:0; transition:opacity 0.3s; font-family:"Noto Sans SC","PingFang SC","Microsoft YaHei",sans-serif; }
|
||||
.gallery-item:hover .gallery-caption { opacity:1; }
|
||||
|
||||
/* 图片展示页 */
|
||||
.image-set-page { max-width:800px; margin:0 auto; }
|
||||
.image-set-page .back-link { font-size:13px; color:var(--ink-lighter); cursor:pointer; margin-bottom:24px; display:inline-block; }
|
||||
.image-set-page .image-grid { display:grid; grid-template-columns:repeat(auto-fill, minmax(200px,1fr)); gap:16px; margin-top:20px; }
|
||||
.image-set-page .image-thumb { aspect-ratio:1; background:var(--white); border-radius:var(--radius); display:flex; align-items:center; justify-content:center; font-size:64px; cursor:pointer; border:1px solid var(--border-light); transition:all 0.2s; }
|
||||
.image-set-page .image-thumb:hover { border-color:var(--cinnabar-light); box-shadow:0 2px 8px var(--shadow); }
|
||||
|
||||
/* 灯箱 */
|
||||
.lightbox { display:none; position:fixed; top:0; left:0; width:100%; height:100%; background:rgba(0,0,0,0.85); backdrop-filter:blur(8px); z-index:200; justify-content:center; align-items:center; flex-direction:column; animation:fadeIn 0.3s; }
|
||||
.lightbox.active { display:flex; }
|
||||
.lightbox-content { background:var(--paper); border-radius:var(--radius-lg); max-width:85vw; max-height:85vh; padding:24px; display:flex; flex-direction:column; align-items:center; box-shadow:0 12px 40px rgba(0,0,0,0.4); animation:scaleIn 0.3s; }
|
||||
.lightbox-image { font-size:128px; display:flex; align-items:center; justify-content:center; min-width:240px; min-height:240px; }
|
||||
.lightbox-caption { margin-top:12px; font-size:15px; color:var(--ink-light); text-align:center; font-weight:500; }
|
||||
.lightbox-close { position:absolute; top:24px; right:36px; font-size:36px; color:#fff; cursor:pointer; opacity:0.8; transition:opacity 0.2s; }
|
||||
.lightbox-close:hover { opacity:1; }
|
||||
.lightbox-nav { position:absolute; top:50%; transform:translateY(-50%); font-size:48px; color:#fff; cursor:pointer; user-select:none; padding:24px; opacity:0.7; transition:opacity 0.2s; }
|
||||
.lightbox-nav:hover { opacity:1; }
|
||||
.lightbox-prev { left:16px; }
|
||||
.lightbox-next { right:16px; }
|
||||
.lightbox-counter { color:#fff; margin-top:10px; font-size:14px; }
|
||||
@keyframes fadeIn { from{opacity:0} to{opacity:1} }
|
||||
@keyframes scaleIn { from{transform:scale(0.9)} to{transform:scale(1)} }
|
||||
|
||||
/* 个人资料 */
|
||||
.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-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; }
|
||||
.profile-stats { display:flex; gap:32px; margin-top:16px; font-family:"Noto Sans SC","PingFang SC","Microsoft YaHei",sans-serif; }
|
||||
.profile-stats .stat { text-align:center; }
|
||||
.profile-stats .stat-number { font-size:20px; font-weight:700; color:var(--cinnabar); font-family:"Noto Serif SC","Source Han Serif SC",serif; }
|
||||
.profile-stats .stat-label { font-size:11px; color:var(--ink-lighter); letter-spacing:0.1em; }
|
||||
.profile-tabs { display:flex; gap:24px; margin-bottom:24px; font-size:14px; font-family:"Noto Sans SC","PingFang SC","Microsoft YaHei",sans-serif; }
|
||||
.profile-tabs span { cursor:pointer; color:var(--ink-lighter); letter-spacing:0.08em; padding-bottom:6px; border-bottom:2px solid transparent; transition:all 0.25s; }
|
||||
.profile-tabs span:hover, .profile-tabs span.active { color:var(--cinnabar); border-bottom-color:var(--cinnabar); }
|
||||
|
||||
.footer { text-align:center; padding:24px 40px; border-top:1px solid var(--border-light); font-size:12px; color:var(--ink-lighter); letter-spacing:0.1em; font-family:"Noto Sans SC","PingFang SC","Microsoft YaHei",sans-serif; }
|
||||
.footer .motto { margin-bottom:6px; color:var(--ink-light); font-family:"Noto Serif SC","Source Han Serif SC",serif; }
|
||||
|
||||
@media (max-width:720px){
|
||||
.main-content{padding:24px;}
|
||||
.top-bar{padding:0 24px; flex-direction:column; gap:8px; height:auto; padding-top:12px; padding-bottom:12px;}
|
||||
:root{--topbar-height:100px;}
|
||||
.nav-links{gap:16px;}
|
||||
.profile-header{flex-direction:column; align-items:center; text-align:center;}
|
||||
.profile-stats{justify-content:center;}
|
||||
.gallery-masonry{column-count:2;}
|
||||
.pinned-card{flex-direction:column; align-items:flex-start;}
|
||||
.pinned-cover{width:100%; height:160px;}
|
||||
}
|
||||
@media (max-width:480px){
|
||||
.gallery-masonry{column-count:1;}
|
||||
.papers-grid{grid-template-columns:1fr;}
|
||||
}
|
||||
|
||||
/* WordPress avatar styling (not in original DeepSeek UI) */
|
||||
.pinned-avatar, .card-avatar, .tucao-avatar {
|
||||
width: 16px !important;
|
||||
height: 16px !important;
|
||||
border-radius: 50% !important;
|
||||
vertical-align: middle;
|
||||
object-fit: cover;
|
||||
}
|
||||
.pinned-meta__author, .card-author, .tucao-header {
|
||||
display: inline-flex !important; align-items: center !important; gap: 4px !important;
|
||||
}
|
||||
.pinned-meta { display: flex; align-items: center; gap: 12px; flex-wrap: wrap; }
|
||||
.pinned-meta span:last-child { margin-left: auto; }
|
||||
.card-cover img, .pinned-cover img, .article-cover img, .gallery-placeholder img {
|
||||
width: 100%; height: 100%; object-fit: cover;
|
||||
}
|
||||
.card-cover { overflow: hidden; }
|
||||
|
||||
/* WP uses <a> for cards instead of div onclick */
|
||||
.pinned-card, .paper-card, .article-item, .gallery-item {
|
||||
text-decoration: none;
|
||||
color: inherit;
|
||||
}
|
||||
.logo-area, .logo-area:hover, .logo-area:visited { text-decoration: none !important; }
|
||||
|
||||
/* WP wrapper — ensure full width in body flex container */
|
||||
.site {
|
||||
width: 100%;
|
||||
display: flex;
|
||||
justify-content: center;
|
||||
}
|
||||
|
||||
/* Force full width on all pages */
|
||||
body.wp-singular .site,
|
||||
body.page-template .site,
|
||||
body.archive .site,
|
||||
body.home .site,
|
||||
body .site { width: 100% !important; }
|
||||
.platform { width: 100% !important; max-width: 960px !important; }
|
||||
Reference in New Issue
Block a user