A simple WordPress development template featuring a block theme and companion plugin
- Block Theme: Full Site Editing compatible WordPress theme
- Companion Plugin: Separate plugin for site-specific functionality
- SCSS Processing: Built-in Sass compilation for custom styles
- Local Development: WordPress environment via
@wordpress/env - Project Initialization: Script to customize project name and slug
- Node.js (v14 or higher)
- npm or yarn
- Docker (for wp-env)
-
Clone or download this template
-
Install dependencies
npm install
-
Initialize your project
npm run init-project
This will prompt you for:
- Project name (e.g., "My Awesome Site")
- Project slug (e.g., "my-awesome-site")
The script will:
- Replace all "Template" references with your project name
- Rename theme and plugin folders to use your project slug
- Update all configuration files
- Clean up by removing the init script
-
Start the development environment
npm start
-
Access your site
- Frontend: http://localhost:8888
- Admin: http://localhost:8888/wp-admin
- Username:
admin - Password:
password
npm run init-project- Initialize project with custom name and slug (one-time use)npm start- Start WordPress development environmentnpm stop- Stop WordPress development environmentnpm run build- Build/compile SCSS and JavaScriptnpm run watch- Watch files and auto-compile on changesnpm run package- Create distributable theme zip filenpm run wp-env- Run wp-env commands directly
site-template/
├── wp-content/
│ ├── themes/
│ │ └── template-theme/ # Block theme
│ │ ├── build/ # Compiled CSS output
│ │ ├── parts/ # Template parts
│ │ ├── patterns/ # Block patterns
│ │ ├── styles/ # SCSS source files
│ │ ├── templates/ # Page templates
│ │ ├── functions.php # Theme functions
│ │ ├── style.css # Theme metadata
│ │ └── theme.json # Theme configuration
│ └── plugins/
│ └── template-plugin/ # Companion plugin
│ └── template-plugin.php
├── .wp-env.json # WordPress environment config
├── webpack.config.js # Webpack configuration for building
├── init-project.js # Project initialization script (removed after init)
└── package.json # Node.js dependencies and scripts
The theme uses WordPress's Full Site Editing features:
- Templates: Located in
/templates/, define page layouts - Template Parts: Located in
/parts/, reusable components like headers - Patterns: Located in
/patterns/, pre-designed block layouts - Styles: SCSS files in
/styles/compile to/build/
The companion plugin (template-plugin) is for site-specific functionality that should persist regardless of theme changes.
- Edit SCSS files in
/wp-content/themes/template-theme/styles/ - Edit JavaScript in
/wp-content/themes/template-theme/src/ - Run
npm run buildto compile assets - Or use
npm run watchfor auto-compilation during development
The compiled CSS and JavaScript are output to /build/ and automatically enqueued by the theme.
After running npm run init-project, the following changes occur:
- All "Template" text is replaced with your project name
- Theme folder renamed from
template-themeto[your-slug]-theme - Plugin folder renamed from
template-pluginto[your-slug]-plugin - Plugin file renamed from
template-plugin.phpto[your-slug]-plugin.php - Configuration files updated (package.json, .wp-env.json, webpack.config.js, .gitignore)
- The init-project script and npm command are removed (one-time use)