rbfraphael/wp-theme

面向开发者的Wordpress主题样板。

安装: 1

依赖: 0

建议者: 0

安全性: 0

星标: 1

关注者: 2

分支: 1

公开问题: 0

类型:wordpress-theme

v1.0.1 2024-05-24 02:08 UTC

This package is auto-updated.

Last update: 2024-09-24 02:52:40 UTC


README

一个易于使用的、具有强大文件体系的Wordpress项目主题样板。

Theme Screenshot

1. 安装

首先需要克隆仓库。之后,运行npm install(或yarn install)和composer install来安装所有依赖。如果您还没有安装Composer,请访问官方下载页面

2. 重命名

安装所有Composer和NPM依赖项后,运行npm run rebrand(或yarn rebrand)来运行重命名脚本,该脚本将所有资源(如常量前缀、函数前缀、类名、文本域、主题名称、主题描述等)替换为您的名称。此脚本将询问您一些问题,您需要输入自己的字符串。以下是一些详细信息。

您可以在/build/rebrand.js中查看此重命名过程。

3. 开发

此时,您需要做的只是创建一些令人惊叹的东西。接下来,您可以检查该主题的一些功能,如内置资源、节点脚本和文件结构。

3.1. 内置资源

此主题附带一些有用的前端资源,以帮助您开发主题。

此外,您还可以添加任何您想要的。

3.2. 内置插件和PHP功能

在Wordpress级别,此主题包含一些有用的插件,以帮助您创建强大的管理面板。内置插件包括

作为PHP功能,此主题包含

3.2.1. ACF Builder

在管理自定义字段时使用ACF,此主题使用ACF Builder以轻松管理您的字段,并防止数据库因不必要的字段信息而膨胀。您可以直接从代码中管理您的字段。需要帮助?您可以在此处找到有关如何使用ACF builder的非常强大的文档。

3.3. 文件结构

.
├── assets/ - Here we go!
│   ├── dist/ - The release static files (CSS, JS, images and fonts) comes here
│   └── src/ - Your favorite place for front end
│       ├── fonts/ - Put your font files here (.ttf, .otf etc)
│       ├── img/ - Put your image files here (.png, .jpg, .jpeg, .gif, .bmp etc)
│       ├── js/ - Here is where child cries and mom won't see
│       │   ├── admin/ - Put admin features - like button events, warnings etc - here
│       │   │   └── admin.js - Dumbledore
│       │   └── theme/ - Here is where you will create magic
│       │       ├── components/ - Keep JS files of components - like header and footer - here
│       │       │   └── blocks/ - Using Gutenberg, you may want to use JS on your blocks. Put those JS files here
│       │       ├── CoreFeatures.js - Initialization of some built-in features of this theme
│       │       └── theme.js - Hogwarts
│       ├── scss/ - Things need to look fine
│       │   ├── admin/ - To not conflict theme's CSS with admin's CSS, put your admin styling here
│       │   │   ├── admin.scss - ( ͡° ͜ʖ ͡°)
│       │   │   ├── _bootstrap.scss - You can filter what Bootstrap features will be available on admin
│       │   │   └── _variables-override.scss - To customize bootstrap without editing original files
│       │   └── theme/ - To not conflict theme's CSS with admin's CSS, put your theme styling here
│       │       ├── components/ - Header, footer, Gutenberg blocks...
│       │       ├── helpers/ - Some global available helpers, like mixins
│       │       ├── _bootstrap.scss - Same as admin. You can define what you want from Bootstrap
│       │       ├── theme.scss - •ᴗ•
│       │       └── _variables-override.scss - Same as admin. You can customize Bootstrap without editing original files
│       └── webfonts/ - Put webfonts (.woff, .woff2 etc) here
├── build/ - For node use only. You can ignore this folder
├── includes/ - All your PHP logic goes here
│   ├── classes/ - Classes (~‾▿‾)~
│   │   ├── callbacks/ - Callback classes for blocks, rest api, shortcodes and whatever you want to callback
│   │   │   ├── callbacks.blocks.php
│   │   │   ├── callbacks.restapi.php
│   │   │   └── callbacks.shortcodes.php
│   │   ├── providers/ - Providers are classes that initialize or declare new functionalities, like post types, taxonomies, Gutenberg blocks, actions, shortcodes...
│   │   │   ├── provider.actions.php
│   │   │   ├── provider.adminassets.php
│   │   │   ├── provider.assets.php
│   │   │   ├── provider.blocks.php
│   │   │   ├── provider.customactions.php
│   │   │   ├── provider.customfilters.php
│   │   │   ├── provider.fields.php
│   │   │   ├── provider.filters.php
│   │   │   ├── provider.optionspages.php
│   │   │   ├── provider.posttypes.php
│   │   │   ├── provider.restapi.php
│   │   │   ├── provider.shortcodes.php
│   │   │   ├── provider.sidebars.php
│   │   │   └── provider.taxonomies.php
│   │   └── class.main.php - Define actions, filters and his bindings to providers methods
│   ├── helpers/ - PHP helpers adds public functions to help your development workflow
│   │   ├── simple_html_dom-1.9.1.php
│   │   └── utils.php
│   ├── plugins/ - Wordpress plugins bundled with this theme
│   │   ├── advanced-custom-fields/
│   │   ├── advanced-custom-fields-font-awesome/
│   │   └── pro-features-for-acf/
│   └── bootstrap.php - Isn't the CSS framework.
├── lang/ - Store your language files (.pot and .mo files) here
├── node_modules/ - A brick made by the heaviest metal in the world
├── templates/ - Template files with HTML code
│   ├── blocks/ - Templates for Gutenberg blocks
│   │   └── container.php
│   ├── partials/ - Template parts
│   │   ├── drawer.php
│   │   ├── loader.php
│   │   ├── site-footer.php
│   │   └── site-header.php
│   ├── shortcodes/ - Templates for shortcodes
│   │   └── example.php
│   ├── full-width-no-title.php - An included page template
│   ├── full-width.php - An included page template
│   ├── no-template.php - An included page template
│   ├── no-title.php - An included page template
├── vendor/ - Composer dependencies lands here
├── .purgecssignore - If you're facing some CSS issue, put the selector here, and the purgecss will keep your selector on final CSS files
├── 404.php - Wordpress native 404 page template file
├── archive.php - Wordpress native archive page template file
├── attachment.php - Wordpress native attachment page template file
├── author.php - Wordpress native author page template file
├── category.php - Wordpress native category template file
├── composer.json - You know what this file is
├── date.php - Wordpress native date archive page template file
├── footer.php - Wordpress native footer template file
├── front-page.php - Wordpress native front page template file
├── functions.php - If you work with Wordpress, you know what this file is
├── gulpfile.js - Gulp configuration file
├── header.php - Wordpress native header template file
├── home.php - Wordpress native blog page template file
├── index.php - Wordpress native default template file
├── LICENSE - The GPL v3
├── package.json - Seriously?
├── page.php - Wordpress native page template file
├── README.md - You're reading this file
├── screenshot.png - The screenshot shown on the "Appearance" page of wp-admin
├── search.php - Wordpress native search results page template file
├── single.php - Wordpress native post template file
├── style.css - Wordpress native stylesheet, with your theme information
├── tag.php - Wordpress native tag page template file
└── taxonomy.php - Wordpress native taxonomy page template file

3.4. 节点脚本

有一些NodeJS脚本,您可以使用npm run {script}(或yarn {script})运行。