Initial commit: TechBlog Pro WordPress theme

Features:
- Modern UI with dark mode support
- Code highlighting with copy button
- Auto table of contents
- Reading time & views counter
- Responsive design
- Admin settings page
- AJAX search
This commit is contained in:
Your Name
2026-08-18 16:05:14 +08:00
commit 6d4368fbd1
17 changed files with 4103 additions and 0 deletions
Executable
+83
View File
@@ -0,0 +1,83 @@
<?php
/**
* 404 Template
*
* @package TechBlog Pro
*/
get_header();
?>
<article class="post-card" style="text-align: center; padding: 80px 20px;">
<div style="font-size: 6rem; margin-bottom: 24px;">🚀</div>
<h1 class="post-title" style="font-size: 2rem; margin-bottom: 16px;">404</h1>
<h2 style="font-size: 1.5rem; font-weight: 600; margin-bottom: 16px;">页面未找到</h2>
<div class="post-excerpt" style="max-width: 480px; margin: 0 auto;">
<p>抱歉,您访问的页面不存在。可能已被移动或删除。</p>
</div>
<div style="margin-top: 32px; display: flex; justify-content: center; gap: 16px;">
<a href="<?php echo esc_url(home_url('/')); ?>"
style="display: inline-flex; align-items: center; gap: 8px; padding: 12px 24px; background: var(--primary-color); color: white; border-radius: 8px; font-weight: 600;">
<svg viewBox="0 0 24 24" width="18" height="18" fill="none" stroke="currentColor" stroke-width="2">
<path d="M3 9l9-7 9 7v11a2 2 0 01-2 2H5a2 2 0 01-2-2z"/>
<polyline points="9 22 9 12 15 12 15 22"/>
</svg>
返回首页
</a>
<button onclick="history.back()"
style="display: inline-flex; align-items: center; gap: 8px; padding: 12px 24px; background: var(--bg-secondary); color: var(--text-primary); border: 1px solid var(--border-color); border-radius: 8px; font-weight: 600; cursor: pointer;">
<svg viewBox="0 0 24 24" width="18" height="18" fill="none" stroke="currentColor" stroke-width="2">
<line x1="19" y1="12" x2="5" y2="12"/>
<polyline points="12 19 5 12 12 5"/>
</svg>
返回上页
</button>
</div>
<!-- Search Box -->
<div style="margin-top: 48px; max-width: 400px; margin-left: auto; margin-right: auto;">
<p style="margin-bottom: 16px; color: var(--text-muted);">或者搜索您想要的内容:</p>
<form role="search" method="get" action="<?php echo esc_url(home_url('/')); ?>">
<div style="display: flex; gap: 8px;">
<input type="search" name="s" placeholder="搜索文章..."
style="flex: 1; padding: 12px 16px; border: 1px solid var(--border-color); border-radius: 8px; font-size: 1rem; background: var(--bg-primary); color: var(--text-primary);">
<button type="submit"
style="padding: 12px 20px; background: var(--primary-color); color: white; border: none; border-radius: 8px; font-weight: 600; cursor: pointer;">
搜索
</button>
</div>
</form>
</div>
<!-- Recent Posts -->
<div style="margin-top: 48px; padding-top: 32px; border-top: 1px solid var(--border-color);">
<h3 style="font-size: 1rem; font-weight: 600; margin-bottom: 20px; color: var(--text-muted);">📖 最近发布的文章</h3>
<div style="display: grid; grid-template-columns: repeat(auto-fit, minmax(200px, 1fr)); gap: 16px; max-width: 640px; margin: 0 auto;">
<?php
$recent = new WP_Query(array(
'posts_per_page' => 3,
'post_status' => 'publish',
));
if ($recent->have_posts()) :
while ($recent->have_posts()) : $recent->the_post();
?>
<a href="<?php the_permalink(); ?>"
style="padding: 16px; background: var(--bg-secondary); border-radius: 8px; text-align: left; border: 1px solid var(--border-color);">
<div style="font-size: 0.8125rem; color: var(--text-muted); margin-bottom: 8px;">
<?php echo get_the_date('Y-m-d'); ?>
</div>
<div style="font-weight: 500; color: var(--text-primary); display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden;">
<?php the_title(); ?>
</div>
</a>
<?php
endwhile;
wp_reset_postdata();
endif;
?>
</div>
</div>
</article>
<?php get_footer(); ?>