2026年6月18日网站模板备份

style.css

/*
 Theme Name:  SimplePro 博客样式
 Description: 全站微软雅黑 | 标题思源黑体 | 配图150*150 圆角6px | 深咖链接色 | 移动端字体修复
 Version:      3.2
 Author:       Custom
*/

/* 【关键】字体引入必须放在CSS最顶部,移动端优先加载 */
@import url('https://fonts.googleapis.com/css2?family=Noto+Sans+SC:wght@400;500;700&display=swap');

/* 全局重置 */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

/* 全站正文统一:微软雅黑 */
body {
    font-family: "Microsoft YaHei", sans-serif;
    font-size: 16px;
    line-height: 1.85;
    color: #333;
    background-color: #ffffff;
}

/* 链接样式 深咖啡色 */
a {
    color: #6B4226;
    text-decoration: none;
}
a:hover {
    color: #4F2F1A;
    text-decoration: underline;
}

ul, li {
    list-style: none;
}

/* 页面容器 */
.container {
    width: 980px;
    margin: 0 auto;
    padding: 0 10px;
}

/* 顶部导航 月光博客风格微调 */
.top-nav {
    height: 32px;
    line-height: 32px;
    border-bottom: 1px dashed #ccc;
    margin-bottom: 15px;
    font-size: 14px;
}
.top-nav ul {
    display: flex;
    margin: 0;
    padding: 0;
}
.top-nav li {
    list-style: none;
    margin-right: 20px;
}
.top-nav a {
    color: #6B4226;
    text-decoration: none;
}
.top-nav a:hover {
    color: #4F2F1A;
    text-decoration: underline;
}

/* 站点头部 */
.site-header {
    padding: 20px 0;
}
/* 站点标题:思源黑体 加粗突出 */
.site-title {
    font-family: "Noto Sans SC", "Microsoft YaHei", sans-serif;
    font-size: 26px;
    font-weight: 700;
    line-height: 1.2;
    letter-spacing: 1px;
}
.site-desc {
    color: #666;
    margin-top: 6px;
    font-size: 13px;
}

/* 主体布局 */
.main-wrap {
    display: flex;
    gap: 25px;
}
.primary {
    width: 720px;
}
.sidebar {
    width: 235px;
}

/* 文章列表项 + 清除浮动 保证文字环绕图片 */
.post-item {
    margin-bottom: 25px;
    padding-bottom: 20px;
    border-bottom: 1px dashed #cccccc;
}
.post-item::after {
    content: "";
    display: table;
    clear: both;
}

/* 文章列表标题:思源黑体 增加兜底字体 */
.post-title {
    font-family: "Noto Sans SC", "Microsoft YaHei", sans-serif;
    font-size: 18px;
    font-weight: 500;
    line-height: 1.4;
    margin-bottom: 8px;
}

/* 文章元信息 紧凑间距 */
.post-meta {
    font-size: 12px;
    color: #666;
    margin-bottom: 12px;
}
.post-meta span {
    margin-right: 1px;
}
.post-meta span::after {
    content: "|";
    margin-left: 1px;
    color: #999;
}
.post-meta span:last-child::after {
    display: none;
}

/* 特色配图 150*150 圆角6px */
.list-thumb {
    float: right;
    width: 150px;
    height: 150px;
    margin: 0 0 10px 10px;
    border: 1px solid #cccccc;
    border-radius: 6px;
    overflow: hidden;
}
.list-thumb img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    display: block;
}

/* 文章摘要 */
.post-excerpt {
    font-size: 16px;
    line-height: 1.85;
    color: #333;
}
.read-more {
    margin-left: 5px;
    font-size: 14px;
}

/* 文章详情页标题:思源黑体 */
.single-post .post-title {
    font-family: "Noto Sans SC", "Microsoft YaHei", sans-serif;
    font-size: 20px;
    font-weight: 500;
    text-align: center;
    margin-bottom: 15px;
}
.single-post .post-meta {
    text-align: center;
    margin-bottom: 20px;
}
.post-content {
    font-size: 16px;
    line-height: 1.9;
}
.post-content p {
    margin-bottom: 18px;
}

/* 面包屑  1. 内页:上下双虚线(文章、分类、搜索、归档) */
.breadcrumb.double-line {
    font-size: 13px;
    color: #666;
    margin: 10px 0 15px;
    padding: 8px 0;
    border-top: 1px dashed #ccc;
    border-bottom: 1px dashed #ccc;
}

/* 2. 首页/独立页面:仅底部一条虚线,无上边框 */
.breadcrumb.single-line {
    margin: 0 0 15px;
    padding: 0 0 8px;
    border-bottom: 1px dashed #ccc;
    /* 彻底清除上边框、上边距、内上边距 */
    border-top: none;
    padding-top: 0;
    margin-top: 0;
}



/* 分页 */
.pagination {
    margin: 30px 0;
    text-align: center;
    font-size: 14px;
}
.pagination a, .pagination span {
    padding: 4px 8px;
    border: 1px solid #ccc;
    margin: 0 3px;
}
.pagination .current {
    background: #f2f2f2;
}

/* 侧边栏组件 */
.widget {
    margin-bottom: 20px;
    padding-bottom: 15px;
    border-bottom: 1px dashed #ccc;
}
.widget-title {
    font-size: 15px;
    font-weight: normal;
    margin-bottom: 8px;
    padding-bottom: 4px;
    border-bottom: 1px dashed #ccc;
}
.widget li {
    line-height: 1.9;
    font-size: 14px;
}

/* 页脚 */
.site-footer {
    margin-top: 40px;
    padding: 20px 0;
    border-top: 1px dashed #ccc;
    text-align: center;
    font-size: 13px;
    color: #666;
    line-height: 1.8;
}

/* ========== 移动端适配【核心修复:重新声明思源黑体标题】 ========== */
@media (max-width: 990px) {
    .container {
        width: 100%;
        padding: 0 15px;
    }
    .main-wrap {
        flex-direction: column;
        gap: 20px;
    }
    .primary, .sidebar {
        width: 100%;
    }

    body {
        font-size: 16px;
        line-height: 2.0;
        font-family: "Microsoft YaHei", sans-serif;
    }
    .post-excerpt,
    .post-content {
        font-size: 16px;
        line-height: 2.0;
    }
    /* 移动端强制标题使用思源黑体,兜底微软雅黑 */
    .site-title,
    .post-title,
    .single-post .post-title {
        font-family: "Noto Sans SC", "Microsoft YaHei", sans-serif !important;
    }
    .post-title {
        font-size: 19px;
    }
    .single-post .post-title {
        font-size: 21px;
    }
    .post-meta,
    .breadcrumb {
        font-size: 14px;
    }
    .widget li {
        font-size: 15px;
    }
}

archive.php

<?php get_header(); ?>
<div class="main-wrap">
    <main class="primary">
        <h2 class="archive-title"><?php the_archive_title(); ?></h2>
        <?php if ( have_posts() ) : ?>
            <?php while ( have_posts() ) : the_post(); ?>
                <div class="post-item">
                    <h2 class="post-title">
                        <a href="<?php the_permalink(); ?>"><?php the_title(); ?></a>
                    </h2>
                    <div class="post-meta">
                        <span>作者:<?php the_author(); ?></span>
                        <span><?php echo get_the_date('Y-m-d'); ?></span>
                        <span><?php the_category(' '); ?></span>
                        <span><?php post_view_count(); ?></span>
                    </div>

                    <?php if ( has_post_thumbnail() ) : ?>
                    <div class="list-thumb">
                        <a href="<?php the_permalink(); ?>">
                            <?php the_post_thumbnail('home-thumb'); ?>
                        </a>
                    </div>
                    <?php endif; ?>

                    <div class="post-excerpt">
                        <?php the_excerpt(); ?>
                    </div>
                </div>
            <?php endwhile; ?>
            <div class="pagination">
                <?php the_posts_navigation(); ?>
            </div>
        <?php else : ?>
            <p>暂无内容</p>
        <?php endif; ?>
    </main>
    <?php get_sidebar(); ?>
</div>
<?php get_footer(); ?>

functions.php

<?php
/**
 * SimplePro 月光复刻完整版
 * 已移除全部自制访客/全站统计代码
 * 仅保留:特色图、菜单侧边栏注册、单篇文章阅读量、摘要、关闭评论、清理头部冗余
 */

// 1. 开启特色图 + 自定义缩略图尺寸 180*120 强制裁剪
add_theme_support('post-thumbnails');
add_image_size('home-thumb', 180, 120, true);

// 2. 注册顶部导航菜单 + 侧边栏
add_action('widgets_init', function(){
    register_nav_menu('top-nav', '顶部导航菜单');
    register_sidebar( array(
        'name'          => '侧边栏',
        'id'            => 'sidebar-1',
        'before_widget' => '<div class="widget">',
        'after_widget'  => '</div>',
        'before_title'  => '<h3 class="widget-title">',
        'after_title'   => '</h3>',
    ) );
});

// 3. 单篇文章阅读量统计(仅文章详情页计数,仅用于前台显示单篇浏览次数)
function post_view_count() {
    if ( is_admin() || ! is_single() || is_user_logged_in() ) {
        return;
    }
    global $post;
    $post_id = $post->ID;
    $count = get_post_meta($post_id, 'view_count', true);
    if ( empty($count) ) {
        update_post_meta($post_id, 'view_count', 1);
        $count = 1;
    } else {
        update_post_meta($post_id, 'view_count', intval($count) + 1);
    }
}
add_action('template_redirect', 'post_view_count');

// 输出单篇浏览数字(首页、文章页调用)
function show_view_count(){
    global $post;
    $post_id = $post->ID;
    $count = get_post_meta($post_id, 'view_count', true);
    $count = empty($count) ? 0 : intval($count);
    echo '浏览:'.$count.'次';
}

// 4. 摘要长度与阅读全文按钮
function custom_excerpt_length(){
    return 139;
}
add_filter('excerpt_length', 'custom_excerpt_length', 999);

function custom_excerpt_more($more){
    return '…… <a class="read-more" href="'.get_permalink().'">[阅读全文]</a>';
}
add_filter('excerpt_more', 'custom_excerpt_more');

// 5. 全站关闭评论、关闭pingback
add_filter('comments_open', '__return_false');
add_filter('pings_open', '__return_false');

// 6. 清理网页头部多余冗余代码
remove_action('wp_head', 'wp_generator');
remove_action('wp_head', 'rsd_link');
remove_action('wp_head', 'wlwmanifest_link');
remove_action('wp_head', 'feed_links_extra', 3);

header.php

<!DOCTYPE html>
<html lang="<?php bloginfo('language'); ?>">
<head>
    <meta charset="<?php bloginfo('charset'); ?>">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title><?php wp_title('|', true, 'right'); ?><?php bloginfo('name'); ?></title>
    <link rel="stylesheet" href="<?php echo get_stylesheet_uri(); ?>">
    <?php wp_head(); ?>
</head>
<body>
<div class="container">
    <!-- 顶部导航 -->
    <nav class="top-nav">
        <?php
        wp_nav_menu(array(
            'theme_location' => 'top-nav',
            'container' => '',
            'fallback_cb' => '<ul><li><a href="'.home_url().'">首页</a></li></ul>'
        ));
        ?>
    </nav>

    <!-- 站点标题&描述 -->
    <header class="site-header">
        <h1 class="site-title"><a href="<?php echo home_url(); ?>"><?php bloginfo('name'); ?></a></h1>
        <div class="site-desc"><?php bloginfo('description'); ?></div>
    </header>

<!-- 面包屑导航 -->
<?php if ( !is_home() && !is_front_page() && !is_page() ) : ?>
    <!-- 文章/分类/搜索/归档页:上下双虚线容器 -->
    <div class="breadcrumb double-line">
        <a href="<?php echo home_url(); ?>">首页</a>
        <?php if(is_category()): ?>
            &raquo; <?php single_cat_title(); ?>
        <?php elseif(is_single()): ?>
            &raquo; <?php the_category(' &raquo; '); ?> &raquo; <?php the_title(); ?>
        <?php elseif(is_search()): ?>
            &raquo; 搜索:<?php echo get_search_query(); ?>
        <?php elseif(is_archive()): ?>
            &raquo; <?php the_archive_title(); ?>
        <?php endif; ?>
    </div>
<?php else : ?>
    <!-- 首页/独立页面:仅底部单虚线空容器,无文字 -->
    <div class="breadcrumb single-line"></div>
<?php endif; ?>

footer.php

    <footer class="site-footer">
        <p>Copyright &copy; <?php echo date('Y'); ?> <?php bloginfo('name'); ?> 版权所有</p>
        <p>鲁ICP备2026028318号</p>
        <a href="https://19336.com/wp-admin"> <p>网站管理</p> </a>
   </footer>
</div>
<?php wp_footer(); ?>
</body>
</html>

index.php

<?php get_header(); ?>
<div class="main-wrap">
    <main class="primary">
        <?php if ( have_posts() ) : ?>
            <?php while ( have_posts() ) : the_post(); ?>
                <div class="post-item">
                    <h2 class="post-title">
                        <a href="<?php the_permalink(); ?>"><?php the_title(); ?></a>
                    </h2>
                    <!-- 元信息:作者 | 日期 | 分类 | 浏览量 -->
                    <div class="post-meta">
                        <span>作者:<?php the_author(); ?></span>
                        <span><?php echo get_the_date('Y-m-d'); ?></span>
                        <span><?php the_category(' '); ?></span>
                        <!-- 替换为输出浏览数字的函数 show_view_count() -->
                        <span><?php show_view_count(); ?></span>
                    </div>

                    <!-- 右上角特色图 180*120 -->
                    <?php if ( has_post_thumbnail() ) : ?>
                    <div class="list-thumb">
                        <a href="<?php the_permalink(); ?>">
                            <?php the_post_thumbnail('home-thumb'); ?>
                        </a>
                    </div>
                    <?php endif; ?>

                    <!-- 摘要 180字 + 阅读全文 -->
                    <div class="post-excerpt">
                        <?php the_excerpt(); ?>
                    </div>
                </div>
            <?php endwhile; ?>

            <!-- 分页 -->
            <div class="pagination">
                <?php the_posts_navigation(); ?>
            </div>

        <?php else : ?>
            <p>暂无文章</p>
        <?php endif; ?>
    </main>
    <?php get_sidebar(); ?>
</div>
<?php get_footer(); ?>

page.php

<?php get_header(); ?>
<div class="container">
    <div class="main-wrap">
        <main class="primary">
            <?php if ( have_posts() ) : while ( have_posts() ) : the_post(); ?>
                <h1 class="post-title"><?php the_title(); ?></h1>
                <div class="post-content">
                    <?php the_content(); ?>
                    <?php wp_link_pages([
                        'before' => '<div class="page-pagination">分页:',
                        'after'  => '</div>'
                    ]); ?>
                </div>
            <?php endwhile; endif; ?>
        </main>
        <?php get_sidebar(); ?>
    </div>
</div>
<?php get_footer(); ?>

sidebar.php

<?php
/**
 * 侧边栏 sidebar.php
 * 无任何前台流量统计展示,全站流量仅后台Koko Analytics查看
 */
?>
<aside class="sidebar">
    <!-- 1.站内搜索 -->
    <div class="widget">
        <h3 class="widget-title">站内搜索</h3>
        <div style="padding:0 10px;">
            <?php get_search_form(); ?>
        </div>
    </div>

    <!-- 2.关于力哥 -->
    <div class="widget">
        <h3 class="widget-title">关于力哥</h3>
        <div style="padding:0 10px; line-height:1.8;">
            <p>人到中年,记录读书感悟、生活复盘与成长思考。分享平凡日子里的温暖与清醒。</p>
            <a href="https://19336.com/sample-page/" style="color:#0073aa;">完整介绍 →</a>
        </div>
    </div>

    <!-- 3.最新文章 -->
    <div class="widget">
        <h3 class="widget-title">最新文章</h3>
        <ul style="margin:0; padding-left:18px;">
            <?php
            $recent_posts = wp_get_recent_posts([
                'numberposts' => 8,
                'post_status' => 'publish'
            ]);
            foreach($recent_posts as $item):
            ?>
                <li style="margin:6px 0;">
                    <a href="<?php echo get_permalink($item['ID']); ?>">
                        <?php echo esc_html($item['post_title']); ?>
                    </a>
                </li>
            <?php endforeach; wp_reset_postdata(); ?>
        </ul>
    </div>

    <!-- 4.热门文章(基于单篇view_count阅读量排序) -->
    <div class="widget">
        <h3 class="widget-title">热门文章</h3>
        <ul style="margin:0; padding-left:18px;">
            <?php
            $hot_posts = get_posts([
                'meta_key' => 'view_count',
                'orderby' => 'meta_value_num',
                'order' => 'DESC',
                'numberposts' => 6,
                'post_status' => 'publish'
            ]);
            foreach($hot_posts as $item):
                $cnt = get_post_meta($item->ID,'view_count',true);
                $cnt = empty($cnt) ? 0 : intval($cnt);
            ?>
                <li style="margin:6px 0;">
                    <a href="<?php echo get_permalink($item->ID); ?>">
                        <?php echo esc_html($item->post_title); ?>
                    </a>
                    <span style="color:#999; font-size:13px;">(<?php echo $cnt; ?>次)</span>
                </li>
            <?php endforeach; wp_reset_postdata(); ?>
        </ul>
    </div>

    <!-- 5.随机随笔 -->
    <div class="widget">
        <h3 class="widget-title">随机随笔</h3>
        <ul style="margin:0; padding-left:18px;">
            <?php
            $rand_post = get_posts([
                'numberposts' => 1,
                'orderby' => 'rand',
                'post_status' => 'publish'
            ]);
            foreach($rand_post as $item):
            ?>
                <li style="margin:6px 0;">
                    <a href="<?php echo get_permalink($item->ID); ?>">
                        <?php echo esc_html($item->post_title); ?>
                    </a>
                </li>
            <?php endforeach; wp_reset_postdata(); ?>
        </ul>
    </div>

    <!-- 6.文章归档 -->
    <div class="widget">
        <h3 class="widget-title">归档</h3>
        <ul style="margin:0; padding-left:18px;">
            <?php wp_get_archives([
                'type' => 'monthly',
                'limit' => 12,
                'show_post_count' => true
            ]); ?>
        </ul>
    </div>

    <!-- 7.分类目录 -->
    <div class="widget">
        <h3 class="widget-title">分类目录</h3>
        <ul style="margin:0; padding-left:18px;">
            <?php wp_list_categories([
                'title_li' => '',
                'show_count' => true,
                'orderby' => 'name'
            ]); ?>
        </ul>
    </div>

    <!-- 8.内容标签 -->
    <div class="widget">
        <h3 class="widget-title">内容标签</h3>
        <div style="padding-left:10px; line-height:2.2;">
            <?php wp_tag_cloud([
                'smallest' => 12,
                'largest' => 16,
                'number' => 25,
                'format' => 'flat',
                'separator' => '  '
            ]); ?>
        </div>
    </div>
</aside>

single.php

<?php get_header(); ?>
<div class="container">
    <div class="main-wrap">
        <main class="primary">
            <?php if ( have_posts() ) : while ( have_posts() ) : the_post(); ?>
                <h1 class="post-title"><?php the_title(); ?></h1>
							<div class="post-meta">
								作者:<?php the_author(); ?> | <?php echo get_the_date('Y-m-d'); ?> | <?php the_category(' | '); ?> | <?php show_view_count(); ?>
							</div>
                <div class="post-content">
                    <?php the_content(); ?>
                    <?php wp_link_pages(['before'=>'<div class="page-links">','after'=>'</div>']); ?>
                </div>
            <?php endwhile; endif; ?>
        </main>
        <?php get_sidebar(); ?>
    </div>
</div>
<?php get_footer(); ?>

search.php

<?php get_header(); ?>
<div class="main-wrap">
    <main class="primary">
        <h2>搜索结果:<?php echo get_search_query(); ?></h2>
        <?php if ( have_posts() ) : ?>
            <?php while ( have_posts() ) : the_post(); ?>
                <div class="post-item">
                    <h2 class="post-title">
                        <a href="<?php the_permalink(); ?>"><?php the_title(); ?></a>
                    </h2>
                    <div class="post-meta">
                        <span>作者:<?php the_author(); ?></span>
                        <span><?php echo get_the_date('Y-m-d'); ?></span>
                        <span><?php the_category(' '); ?></span>
                        <span><?php post_view_count(); ?></span>
                    </div>

                    <?php if ( has_post_thumbnail() ) : ?>
                    <div class="list-thumb">
                        <a href="<?php the_permalink(); ?>">
                            <?php the_post_thumbnail('home-thumb'); ?>
                        </a>
                    </div>
                    <?php endif; ?>

                    <div class="post-excerpt">
                        <?php the_excerpt(); ?>
                    </div>
                </div>
            <?php endwhile; ?>
            <div class="pagination">
                <?php the_posts_navigation(); ?>
            </div>
        <?php else : ?>
            <p>未搜索到相关内容</p>
        <?php endif; ?>
    </main>
    <?php get_sidebar(); ?>
</div>
<?php get_footer(); ?>

以上是主题的全部文件,可以可以直接复制成文本文件,直接保存成对应的PHP或者CSS文件,然后打包压纹为.ZIP文件,在WORDPRESS后台进行主题的上传安装。也可以直接进行下载下面的主题。

下载后无需解压,直接上传主题,安装成功,启用主题。