๐Ÿ“– Lesson 4 of 13

Building, Activating, and Running dev_setup via WP-CLI

With dependencies locked, you are ready to compile the theme, activate it in WordPress, and execute the automated `dev_setup` command via WP-CLI.

In this lesson, you will learn how to trigger the compiler, perform theme activation, and establish essential development structures.


1. Run the Build Command

First, run the initial compiler script. This parses source files in `src/` (CSS, JS, images, fonts) and processes them into ready development artifacts in `assets/`:

“`bash npm run build “` This script compiles styles with Autoprefixer and nesting, minifies JavaScript files, processes icons, and prepares standard development assets.


2. Activate the Theme

With the theme compiled, you can activate it. You can do this by navigating to your WordPress dashboard (`Appearance โ†’ Themes` and click *Activate*), or use **WP-CLI** (highly recommended for speed):

Using WordPress Studio CLI

Using LocalWP or Native WP-CLI

Verify that the theme is active by running: “`bash studio wp theme list –status=active “`


3. Run the `dev_setup` Script

WP Rig comes with a custom, automated setup command that configures your WordPress database for development. Running `dev_setup` automatically: 1. Imports placeholder starter menus and pages. 2. Sets permalinks to beautiful URLs (`/%postname%/`). 3. Establishes dummy categories and demo tags. 4. Configures default settings (reading page settings, deactivating search engines indexes, etc.).

Execute the command from your terminal:

Under WordPress Studio

Under LocalWP or Native WP-CLI

**Key Takeaway:** By running `dev-setup.php` immediately after activation, your local sandbox is instantly populated with structured testing content, saving you hours of clicking and manual configurations!

Now that your theme is active and your sandbox is populated, let’s look at launching your daily workspace and navigating asset directories!