Sitelet https://github.com/okfse/wordpress-theme/pull/1/commits/c0434c409e69095638cd72c47cdc094e41b8f6f6
Skip to content
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Next Next commit
Activate OK Network Chapter automatically in wp-env
Fresh WordPress always boots Twenty Twenty-Five. afterStart and npm start
now switch stylesheet to this theme so localhost:8888 shows the preview.
  • Loading branch information
mattiasaxell committed Aug 20, 2026
commit c0434c409e69095638cd72c47cdc094e41b8f6f6
6 changes: 5 additions & 1 deletion .wp-env.json
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,10 @@
"config": {
"WP_DEBUG": true,
"WP_DEBUG_LOG": true,
"SCRIPT_DEBUG": true
"SCRIPT_DEBUG": true,
"WP_DEFAULT_THEME": "wordpress-theme"
},
"lifecycleScripts": {
"afterStart": "npx --yes @wordpress/env run cli wp theme activate wordpress-theme"
}
}
18 changes: 16 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -17,10 +17,24 @@ First intended deployment: [okfn.se](https://okfn.se/). Other chapters can reuse
From this directory:

```sh
npx @wp-env/cli start # or: npm i -D @wordpress/env && npx wp-env start
npm install
npm start
```

`.wp-env.json` boots WordPress 7.0.4 with this folder as the active theme.
That runs [wp-env](https://developer.wordpress.org/block-editor/reference-guides/packages/packages-env/) (WordPress 7.0.4) **and activates this theme**. A plain `npx wp-env start` leaves Twenty Twenty-Five active — WordPress always installs a default theme; ours is mapped in as `wordpress-theme` and must be switched on.

| URL | What |
|---|---|
| http://localhost:8888/ | Front end (hero, cards, latest posts, footer) |
| http://localhost:8888/wp-admin/ | Admin. User `admin`, password `password` |

If the site is already running and still shows Twenty Twenty-Five:

```sh
npx wp-env run cli wp theme activate wordpress-theme
```

Then reload http://localhost:8888/. You do **not** need to set a Site Logo or rebuild pages to preview: `templates/front-page.html` already inserts the OK Network patterns.

PHP syntax:

Expand Down
14 changes: 14 additions & 0 deletions package.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
{
"name": "okfn-chapter",
"private": true,
"description": "OK Network Chapter WordPress block theme — local wp-env helpers",
"scripts": {
"start": "wp-env start && wp-env run cli wp theme activate wordpress-theme",
"stop": "wp-env stop",
"destroy": "wp-env destroy",
"wp": "wp-env run cli wp"
},
"devDependencies": {
"@wordpress/env": "^10.33.0"
}
}
Loading