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:
Executable
+104
@@ -0,0 +1,104 @@
|
||||
<!DOCTYPE html>
|
||||
<html <?php language_attributes(); ?> data-theme="light">
|
||||
<head>
|
||||
<meta charset="<?php bloginfo('charset'); ?>">
|
||||
<meta name="viewport" content="width=device-width, initial-scale=1.0">
|
||||
<meta name="description" content="<?php bloginfo('description'); ?>">
|
||||
<?php wp_head(); ?>
|
||||
</head>
|
||||
<body <?php body_class(); ?>>
|
||||
<?php wp_body_open(); ?>
|
||||
|
||||
<header class="site-header">
|
||||
<div class="header-inner">
|
||||
<!-- Logo -->
|
||||
<a href="<?php echo esc_url(home_url('/')); ?>" class="site-logo">
|
||||
<svg viewBox="0 0 32 32" xmlns="http://www.w3.org/2000/svg">
|
||||
<path d="M16 2L2 9l14 7 14-7L16 2zM2 23l14 7 14-7M2 16l14 7 14-7"/>
|
||||
</svg>
|
||||
<?php bloginfo('name'); ?>
|
||||
</a>
|
||||
|
||||
<!-- Navigation -->
|
||||
<nav class="main-nav" id="main-nav">
|
||||
<?php
|
||||
if (has_nav_menu('primary')) {
|
||||
wp_nav_menu(array(
|
||||
'theme_location' => 'primary',
|
||||
'container' => false,
|
||||
'items_wrap' => '%3$s',
|
||||
'walker' => new TechBlog_Nav_Walker(),
|
||||
));
|
||||
} else {
|
||||
// Default menu
|
||||
?>
|
||||
<a href="<?php echo esc_url(home_url('/')); ?>" class="current">首页</a>
|
||||
<a href="<?php echo esc_url(get_permalink(get_option('page_for_posts'))); ?>">博客</a>
|
||||
<?php
|
||||
// Get categories
|
||||
$categories = get_categories(array('number' => 4, 'orderby' => 'count', 'order' => 'DESC'));
|
||||
foreach ($categories as $cat) {
|
||||
echo '<a href="' . esc_url(get_category_link($cat->term_id)) . '">' . esc_html($cat->name) . '</a>';
|
||||
}
|
||||
}
|
||||
?>
|
||||
</nav>
|
||||
|
||||
<!-- Header Actions -->
|
||||
<div class="header-actions">
|
||||
<button class="search-toggle" id="search-toggle" aria-label="搜索">
|
||||
<svg viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2">
|
||||
<circle cx="11" cy="11" r="8"/>
|
||||
<path d="m21 21-4.3-4.3"/>
|
||||
</svg>
|
||||
</button>
|
||||
|
||||
<button class="theme-toggle" id="theme-toggle" aria-label="切换主题">
|
||||
<svg class="sun-icon" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2">
|
||||
<circle cx="12" cy="12" r="5"/>
|
||||
<line x1="12" y1="1" x2="12" y2="3"/>
|
||||
<line x1="12" y1="21" x2="12" y2="23"/>
|
||||
<line x1="4.22" y1="4.22" x2="5.64" y2="5.64"/>
|
||||
<line x1="18.36" y1="18.36" x2="19.78" y2="19.78"/>
|
||||
<line x1="1" y1="12" x2="3" y2="12"/>
|
||||
<line x1="21" y1="12" x2="23" y2="12"/>
|
||||
<line x1="4.22" y1="19.78" x2="5.64" y2="18.36"/>
|
||||
<line x1="18.36" y1="5.64" x2="19.78" y2="4.22"/>
|
||||
</svg>
|
||||
<svg class="moon-icon" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" style="display:none">
|
||||
<path d="M21 12.79A9 9 0 1 1 11.21 3 7 7 0 0 0 21 12.79z"/>
|
||||
</svg>
|
||||
</button>
|
||||
|
||||
<button class="mobile-menu-toggle" id="mobile-menu-toggle" aria-label="菜单">
|
||||
<svg viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2">
|
||||
<line x1="3" y1="6" x2="21" y2="6"/>
|
||||
<line x1="3" y1="12" x2="21" y2="12"/>
|
||||
<line x1="3" y1="18" x2="21" y2="18"/>
|
||||
</svg>
|
||||
</button>
|
||||
</div>
|
||||
</div>
|
||||
</header>
|
||||
|
||||
<!-- Search Overlay -->
|
||||
<div class="search-overlay" id="search-overlay">
|
||||
<div class="search-container">
|
||||
<form role="search" method="get" action="<?php echo esc_url(home_url('/')); ?>">
|
||||
<div class="search-input-wrapper">
|
||||
<svg viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2">
|
||||
<circle cx="11" cy="11" r="8"/>
|
||||
<path d="m21 21-4.3-4.3"/>
|
||||
</svg>
|
||||
<input type="search" class="search-input" name="s" placeholder="搜索文章..." autocomplete="off" autofocus>
|
||||
</div>
|
||||
</form>
|
||||
<div class="search-hint">
|
||||
<span>输入关键词搜索</span>
|
||||
<kbd>ESC</kbd> 关闭
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<main class="site-container">
|
||||
<div class="content-area">
|
||||
Reference in New Issue
Block a user