diff --git a/.editorconfig b/.editorconfig
new file mode 100644
index 0000000..3bcca5f
--- /dev/null
+++ b/.editorconfig
@@ -0,0 +1,16 @@
+root = true
+
+[*]
+charset = utf-8
+end_of_line = lf
+indent_style = tab
+indent_size = 4
+insert_final_newline = true
+trim_trailing_whitespace = true
+
+[*.{json,yml,yaml}]
+indent_style = space
+indent_size = 2
+
+[*.md]
+trim_trailing_whitespace = false
diff --git a/.eslintrc.json b/.eslintrc.json
new file mode 100644
index 0000000..48b15a5
--- /dev/null
+++ b/.eslintrc.json
@@ -0,0 +1,20 @@
+{
+ "root": true,
+ "extends": [
+ "plugin:@wordpress/eslint-plugin/recommended",
+ "plugin:@typescript-eslint/recommended"
+ ],
+ "parser": "@typescript-eslint/parser",
+ "parserOptions": {
+ "ecmaVersion": 2020,
+ "sourceType": "module",
+ "project": "./tsconfig.json"
+ },
+ "plugins": ["@typescript-eslint"],
+ "rules": {
+ "@typescript-eslint/no-unused-vars": ["error", { "argsIgnorePattern": "^_" }],
+ "@typescript-eslint/explicit-function-return-type": "warn",
+ "no-console": "warn"
+ },
+ "ignorePatterns": ["vendor/", "node_modules/", "assets/", "dist/"]
+}
diff --git a/.gitignore b/.gitignore
index 6704566..674fedb 100644
--- a/.gitignore
+++ b/.gitignore
@@ -102,3 +102,25 @@ dist
# TernJS port file
.tern-port
+
+# -----------------------------------------------
+# CyyWordpress additions
+# -----------------------------------------------
+# Build output
+assets/js/
+assets/css/
+assets/.vite/
+*.map
+
+# Packaged theme zip
+*.zip
+
+# OS / editor
+.DS_Store
+Thumbs.db
+.idea/
+.vscode/settings.json
+
+# Composer: vendor is committed for deployment, but generated files are not
+composer.lock
+
diff --git a/.nvmrc b/.nvmrc
new file mode 100644
index 0000000..209e3ef
--- /dev/null
+++ b/.nvmrc
@@ -0,0 +1 @@
+20
diff --git a/.stylelintrc.json b/.stylelintrc.json
index 959130a..86cae24 100644
--- a/.stylelintrc.json
+++ b/.stylelintrc.json
@@ -1,16 +1,13 @@
{
- "extends": [
- "stylelint-config-wordpress/scss"
- ],
- "ignoreFiles": [
- "sass/_normalize.scss"
- ],
- "rules": {
- "font-family-no-missing-generic-family-keyword": null,
- "no-descending-specificity": null,
- "block-no-empty": null,
- "no-duplicate-selectors": null,
- "font-family-no-duplicate-names": null,
- "selector-class-pattern": null
- }
+ "extends": ["stylelint-config-standard-scss"],
+ "rules": {
+ "color-named": "never",
+ "declaration-no-important": true,
+ "max-nesting-depth": 3,
+ "selector-class-pattern": "^[a-z][a-z0-9-_]*(__[a-z0-9-_]+)?(--[a-z0-9-_]+)?$",
+ "scss/dollar-variable-pattern": "^[a-z][a-z0-9-_]*$",
+ "scss/at-mixin-pattern": "^[a-z][a-z0-9-_]*$"
+ },
+ "ignoreFiles": ["node_modules/**", "vendor/**", "assets/**"]
}
+
diff --git a/README.md b/README.md
index eb64a1a..e9b75d3 100644
--- a/README.md
+++ b/README.md
@@ -1,2 +1,125 @@
# CyyWordpress
-一个自用的Wordpress主题
+
+一个基于 **Bulma 1.x** + **Underscores (_s)** 的现代 WordPress 主题,专为中文博客场景设计。
+
+---
+
+## 环境要求
+
+| 依赖 | 最低版本 |
+|------|---------|
+| PHP | 8.1 |
+| WordPress | 6.0 |
+| Node.js | 20(见 `.nvmrc`)|
+| npm | 10+ |
+
+---
+
+## 本地开发环境配置
+
+```bash
+# 1. 安装正确的 Node.js 版本(推荐使用 nvm)
+nvm use # 读取 .nvmrc 自动切换到 Node 20
+
+# 2. 安装前端依赖
+npm install
+
+# 3. 启动 Vite 开发服务器(HMR)
+npm run dev
+
+# 4. 生产构建(含 contenthash 文件指纹)
+npm run build
+
+# 5. 生成 RTL 样式
+npm run build:rtl
+```
+
+> **注意:** 开发时,将 WordPress 的 `WP_HOME` 指向 `http://localhost:3000`,
+> Vite 会代理所有请求到本地 WordPress 实例并启用热更新。
+
+---
+
+## 构建流程说明
+
+| 命令 | 说明 |
+|------|------|
+| `npm run dev` | 启动 Vite 开发服务器(端口 3000,支持 HMR)|
+| `npm run build` | 生产构建,输出到 `assets/`(含 contenthash)|
+| `npm run build:rtl` | 生成 `assets/css/main-rtl.css` |
+| `npm run lint` | 运行 ESLint + StyleLint |
+| `npm run type-check` | TypeScript 类型检查(不生成文件)|
+
+构建产物由 `inc/class-cyywordpress-assets.php` 读取 `assets/.vite/manifest.json`
+自动解析带 hash 的文件名注入到 `wp_enqueue_*`。
+
+---
+
+## SCSS 变量覆盖(子主题)
+
+在子主题的入口 SCSS 文件中,在 `@use 'cyywordpress/scss/abstracts/variables'` **之前**
+重新声明你希望覆盖的 CSS 自定义属性:
+
+```scss
+:root {
+ --color-primary: #6366f1; /* 换成紫色主题 */
+ --color-primary-dark: #4f46e5;
+}
+```
+
+所有组件均使用 `var(--color-primary)` 引用,覆盖后全局生效,无需修改源文件。
+
+---
+
+## Customizer 可配置项
+
+后台路径:**外观 → 自定义 → 首页横幅**
+
+| 选项 | 说明 | 默认值 |
+|------|------|--------|
+| 欢迎横幅文字 | 首页/文章列表顶部的通知文字 | `欢迎来到这!Hello everyone.` |
+| 显示欢迎横幅 | 是否在首页显示横幅 | 勾选 |
+
+---
+
+## 导航菜单位置
+
+| 位置标识 | 显示位置 |
+|---------|---------|
+| `menu-1` | 顶部主导航 |
+| `menu-2` | 页脚导航 |
+| `social` | 页脚社交媒体图标链接 |
+
+---
+
+## Widget 区域
+
+| 区域 ID | 位置 |
+|---------|------|
+| `sidebar-1` | 文章/页面侧边栏 |
+| `sidebar-footer-1` | 页脚左列 |
+| `sidebar-footer-2` | 页脚中列 |
+| `sidebar-footer-3` | 页脚右列 |
+| `sidebar-header` | 导航栏右侧 |
+
+---
+
+## 块模式 (Block Patterns)
+
+注册在 `patterns/` 目录,可在编辑器 **插入块 → 模式 → CyyWordpress** 中使用:
+
+- **Hero 横幅** — 全宽渐变横幅 + CTA 按钮
+- **文章卡片网格** — 三列响应式卡片布局
+- **行动号召区域** — 居中标题 + 双按钮
+
+---
+
+## PHP 代码规范检查
+
+```bash
+composer install
+./vendor/bin/phpcs
+./vendor/bin/phpcbf # 自动修复
+```
+
+规范基于 WordPress Coding Standards + PHPCompatibility(PHP 8.1+)。
+
diff --git a/composer.json b/composer.json
index a89123f..386d807 100644
--- a/composer.json
+++ b/composer.json
@@ -15,13 +15,14 @@
}
],
"require": {
- "php": ">=5.6"
+ "php": ">=8.1"
},
"require-dev": {
- "dealerdirect/phpcodesniffer-composer-installer": "^0.7.0",
+ "dealerdirect/phpcodesniffer-composer-installer": "^1.0.0",
"wptrt/wpthemereview": "^0.2.1",
- "php-parallel-lint/php-parallel-lint": "^1.2.0",
- "wp-cli/i18n-command": "^2.2.5"
+ "php-parallel-lint/php-parallel-lint": "^1.3.0",
+ "wp-cli/i18n-command": "^2.6.0",
+ "phpcompatibility/phpcompatibility-wp": "^2.1"
},
"scripts": {
"lint:wpcs": "@php ./vendor/squizlabs/php_codesniffer/bin/phpcs",
diff --git a/footer.php b/footer.php
index 80e0080..4b42b5c 100644
--- a/footer.php
+++ b/footer.php
@@ -2,7 +2,8 @@
/**
* The template for displaying the footer
*
- * Contains the closing of the #content div and all content after.
+ * Three-column layout: site info | footer nav (menu-2) | social links (social).
+ * Dynamic copyright year. All hardcoded external links removed.
*
* @link https://developer.wordpress.org/themes/basics/template-files/#template-partials
*
@@ -10,75 +11,107 @@
*/
?>
+
-
+
+
-
-
-
-
-
-