A classic PHP-based theme, with modern tooling and support for Gutenberg blocks.
- Webpack 5
- TailwindCSS
- theme.json
- LiveReload
- Github Actions
- WP CLI
- WordPress Coding Standards
- Whole lotta linting, Prettier, and PHPCBF support
This isn't a block theme and does not support full-site editing on purpose.
There's no doubt that block-based themes are the future of WordPress; however, PHP-based themes with deep integration with Gutenberg and modern tooling are still as relevant as ever.
I wanted to create a "classic" theme that gave developers world class support for tooling and the latest Gutenberg block features like theme.json
. Plus, I love to tinker and being on the bleeding edge is fun!
Clone this theme into wp-content/themes
:
git clone [email protected]:gregrickaby/classic-wordpress-theme.git
Install dependencies:
composer install && npm i --legacy-peer-deps
Run a build to bundle all theme assets:
npm run build
Finally, activate the theme in the WordPress dashboard.
The src
directory is where all theme assets should be placed. Webpack is configured to bundle them into the /build
directory.
βββ src
β index.js
β βββ css
β β βββ index.css
β β βββ tailwind.css
β βββ fonts
β β βββ OpenSans-Regular.woff2
β βββ images
β β βββ placeholder.png
β βββ js
β βββ placeholder.js
This theme includes support for TailwindCSS. It uses the JIT compiler, so live reloads are β‘οΈ fast.
To get started, open index.css
and start adding your styles. To customize further, open tailwind.config.js
or theme.json
.
This theme uses Webpack 5 and Babel and is ready for anything esnext
. Simply create your JS files and place them in /src/js/
then use ES6 imports in src/index.js
.
It can frustrating to "tear down" a theme just to get started. I tried to keep the theme files and use of template tags to the bare minimum.
WordPress 5.8 comes with a new mechanism to configure the editor that enables a finer-grained control and introduces the first step in managing styles for future WordPress releases: the theme.json
file.
The theme.json
kinda mimics the config workflow for tailwind.config.js:
// theme.json
{
"version": 1,
"settings": {
"color": {},
"layout": {}
},
"styles": {
"color": {},
"typography": {},
"elements": {},
"blocks": {}
},
"templateParts": {},
"customTemplates": {}
}
You can learn more about theme.json
in the Block Editor Handbook and check out the theme-experiments repo on Github.
Watch for changes and LiveReload:
npm run dev
Now open your browser and click the LiveReload extension.
Bundle assets for production:
npm run build
Format files:
npm run format
Lint files:
npm run lint