Skip to content

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:

bash
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:

bash
# 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 build

Development Mode

bash
wdg my-site dev

Runs 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

bash
wdg my-site build

Runs 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.

bash
# 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 baseline

Both commands accept an optional trailing path to scope the run.

PHP Version

The PHP version is a project property, not a theme property.

bash
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 versions

Supported 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:

bash
# 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=theme

See Repository Management for the full repo reference.

Activating a Theme

Theme activation goes through WP-CLI, which WDG passes through:

bash
wdg my-site wp theme activate my-site-theme
wdg my-site wp theme list

See Also: