Theme Development
There is no wdg theme command namespace. Theme development in WDG is project-scoped and theme-agnostic — you operate on a project's repositories using the project subcommands, and the theme is just one of the repositories mounted into that project.
Everything below uses the project-first grammar:
wdg <project> <command> [options]For the full project command reference, see Project Commands.
The Theme Development Loop
A typical iteration on a project's theme looks like this:
# 1. Start the dev server with file watching (runs npm start)
wdg my-site dev
# 2. Make changes to the theme source...
# Assets recompile automatically while `dev` is running.
# 3. Check code quality
wdg my-site lint --fix
wdg my-site analyze
# 4. Build production assets when ready
wdg my-site buildDevelopment Mode
wdg my-site devRuns npm start in the project's theme or app directory with file watching. Detects package.json automatically and prioritizes the theme directory when both a theme and app define one.
Stop the dev server with Ctrl+C in the terminal where it is running.
Production Build
wdg my-site buildRuns npm run build across the project's theme and app directories to produce production-ready assets.
Code Quality
WDG runs PHP quality tooling against the project's code, including the theme.
# WordPress Coding Standards (PHPCS)
wdg my-site lint
wdg my-site lint --fix # auto-fix where possible
wdg my-site lint --summary # summary report
wdg my-site lint --severity=5 # only report severity >= 5
# Static analysis (PHPStan)
wdg my-site analyze
wdg my-site analyze --level=6 # analysis level
wdg my-site analyze --baseline # generate/use a baselineBoth commands accept an optional trailing path to scope the run.
PHP Version
The PHP version is a project property, not a theme property.
wdg my-site php # show current version
wdg my-site php set 8.3 # change version (rebuilds the container)
wdg my-site php available # list available versionsSupported versions: 8.0, 8.1, 8.2, 8.3, 8.4, 8.5.
Theme as a Repository
A theme lives in the project as a repository. Use the repo subcommands to manage it:
# Turn an existing theme directory into a git repository
wdg my-site repo init my-site-theme
# (Re)install git hooks for the theme (enables auto-indexing on commit)
wdg my-site repo hooks my-site-theme
# Add an external theme repository and mount it as a theme
wdg my-site repo add https://github.com/client/theme --type=themeSee Repository Management for the full repo reference.
Activating a Theme
Theme activation goes through WP-CLI, which WDG passes through:
wdg my-site wp theme activate my-site-theme
wdg my-site wp theme listSee Also: