6d4368fbd1
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
131 lines
5.0 KiB
PHP
Executable File
131 lines
5.0 KiB
PHP
Executable File
</div><!-- /.content-area -->
|
|
|
|
<!-- Sidebar -->
|
|
<aside class="sidebar">
|
|
<?php if (is_active_sidebar('sidebar-main')) : ?>
|
|
<?php dynamic_sidebar('sidebar-main'); ?>
|
|
<?php else : ?>
|
|
<!-- Default Sidebar Content -->
|
|
|
|
<!-- Categories Widget -->
|
|
<div class="sidebar-widget">
|
|
<h3 class="widget-title">📂 文章分类</h3>
|
|
<ul class="category-list">
|
|
<?php
|
|
$categories = get_categories(array(
|
|
'orderby' => 'count',
|
|
'order' => 'DESC',
|
|
'number' => 10,
|
|
));
|
|
foreach ($categories as $cat) :
|
|
?>
|
|
<li>
|
|
<a href="<?php echo esc_url(get_category_link($cat->term_id)); ?>">
|
|
<?php echo esc_html($cat->name); ?>
|
|
<span class="category-count"><?php echo $cat->count; ?></span>
|
|
</a>
|
|
</li>
|
|
<?php endforeach; ?>
|
|
</ul>
|
|
</div>
|
|
|
|
<!-- Recent Posts Widget -->
|
|
<div class="sidebar-widget">
|
|
<h3 class="widget-title">📝 最新文章</h3>
|
|
<ul class="recent-posts-list">
|
|
<?php
|
|
$recent_posts = new WP_Query(array(
|
|
'posts_per_page' => 5,
|
|
'post_status' => 'publish',
|
|
));
|
|
if ($recent_posts->have_posts()) :
|
|
while ($recent_posts->have_posts()) : $recent_posts->the_post();
|
|
?>
|
|
<li>
|
|
<a href="<?php the_permalink(); ?>" class="recent-post-title">
|
|
<?php the_title(); ?>
|
|
</a>
|
|
<span class="recent-post-date">
|
|
<?php echo get_the_date('Y-m-d'); ?>
|
|
</span>
|
|
</li>
|
|
<?php
|
|
endwhile;
|
|
wp_reset_postdata();
|
|
endif;
|
|
?>
|
|
</ul>
|
|
</div>
|
|
|
|
<!-- Tags Widget -->
|
|
<div class="sidebar-widget">
|
|
<h3 class="widget-title">🏷️ 热门标签</h3>
|
|
<div class="tag-cloud">
|
|
<?php
|
|
$tags = get_tags(array(
|
|
'orderby' => 'count',
|
|
'order' => 'DESC',
|
|
'number' => 20,
|
|
));
|
|
foreach ($tags as $tag) :
|
|
?>
|
|
<a href="<?php echo esc_url(get_tag_link($tag->term_id)); ?>">
|
|
<?php echo esc_html($tag->name); ?>
|
|
</a>
|
|
<?php endforeach; ?>
|
|
</div>
|
|
</div>
|
|
<?php endif; ?>
|
|
</aside>
|
|
</main>
|
|
|
|
<!-- Footer -->
|
|
<footer class="site-footer">
|
|
<div class="footer-inner">
|
|
<?php if (is_active_sidebar('footer-1')) : ?>
|
|
<?php dynamic_sidebar('footer-1'); ?>
|
|
<?php else : ?>
|
|
<div class="footer-section">
|
|
<h3>关于我们</h3>
|
|
<p>一个专注于IT技术分享的博客,涵盖Linux运维、编程开发、云计算、容器技术等领域。</p>
|
|
</div>
|
|
<?php endif; ?>
|
|
|
|
<?php if (is_active_sidebar('footer-2')) : ?>
|
|
<?php dynamic_sidebar('footer-2'); ?>
|
|
<?php else : ?>
|
|
<div class="footer-section">
|
|
<h3>快速链接</h3>
|
|
<ul class="footer-links">
|
|
<li><a href="<?php echo esc_url(home_url('/')); ?>">首页</a></li>
|
|
<li><a href="<?php echo esc_url(get_permalink(get_option('page_for_posts'))); ?>">博客</a></li>
|
|
<li><a href="<?php echo esc_url(home_url('/category/linux')); ?>">Linux</a></li>
|
|
<li><a href="<?php echo esc_url(home_url('/category/docker')); ?>">Docker</a></li>
|
|
<li><a href="<?php echo esc_url(home_url('/category/kubernetes')); ?>">Kubernetes</a></li>
|
|
</ul>
|
|
</div>
|
|
<?php endif; ?>
|
|
|
|
<?php if (is_active_sidebar('footer-3')) : ?>
|
|
<?php dynamic_sidebar('footer-3'); ?>
|
|
<?php else : ?>
|
|
<div class="footer-section">
|
|
<h3>联系方式</h3>
|
|
<ul class="footer-links">
|
|
<li><a href="https://github.com" target="_blank">GitHub</a></li>
|
|
<li><a href="mailto:contact@example.com">Email</a></li>
|
|
</ul>
|
|
</div>
|
|
<?php endif; ?>
|
|
</div>
|
|
|
|
<div class="footer-bottom">
|
|
<span>© <?php echo date('Y'); ?> <?php bloginfo('name'); ?>. All rights reserved.</span>
|
|
<span>Powered by WordPress | Theme: TechBlog Pro</span>
|
|
</div>
|
|
</footer>
|
|
|
|
<?php wp_footer(); ?>
|
|
</body>
|
|
</html>
|