Add WordPress Playground blueprint with relative-date demo data - #37
Open
datengraben wants to merge 4 commits into
Open
Add WordPress Playground blueprint with relative-date demo data#37datengraben wants to merge 4 commits into
datengraben wants to merge 4 commits into
Conversation
Introduce a self-contained WordPress Playground blueprint that boots a
throwaway WordPress, installs CommonsBooking, and seeds sample data whose
dates are relative offsets from the current time (never hardcoded), so the
demo always looks current.
- playground/blueprint.json: pins preferredVersions (WP 6.9 / PHP 8.1),
sets timezone_string before data generation, logs in as admin, installs
CommonsBooking from wordpress.org, and drops the generator as a mu-plugin
via writeFile (no runPHP step, no static WXR import).
- playground/generate-demo-data.php: mu-plugin that runs inside a fully
booted request and, guarded to run once per instance, creates locations,
items, bookable timeframes and bookings using
strtotime('+N days', current_time('timestamp')) offsets. Mirrors the
proven pattern in tests/php/CPTCreationTrait.php.
- playground/README.md: ready-to-click playground.wordpress.net URL, an
explanation of each blueprint step, and the follow-up scope for installing
the latest master (nightly) build instead of the released plugin.
Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01DgRcdn1jVhMAUVZBKJQGoJ
WordPress Playground's blueprint schema requires an 'author' property on the 'meta' object; booting without it failed with InvalidBlueprintError. Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01DgRcdn1jVhMAUVZBKJQGoJ
Add a one-click Playground launch button to the root README, matching the WordPress Playground examples gallery style, pointing at the blueprint on master via ?blueprint-url=. Bundle the official Playground button SVG and exclude the playground/ demo tooling from the distributed plugin zip. Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01DgRcdn1jVhMAUVZBKJQGoJ
Extract the inline PHP generator out of blueprint.json into its own playground/test-data.php (renamed from generate-demo-data.php). The blueprint's writeFile step now references the file by URL (a 'url' resource) instead of embedding a copy, making test-data.php the single source of truth and shrinking blueprint.json from ~10KB to ~1KB. Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01DgRcdn1jVhMAUVZBKJQGoJ
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Adds a WordPress Playground blueprint that boots a throwaway WordPress instance in the browser with CommonsBooking pre-installed and populated with sample data. The key innovation is that all booking dates are expressed as relative offsets from the current time, ensuring the demo always appears current regardless of when it's accessed.
Changes
playground/blueprint.json— WordPress Playground blueprint configuration that:.wp-env.json)playground/generate-demo-data.php— Must-use plugin that generates demo data on first request:[cb_items_table]shortcodeplayground/README.md— Documentation covering:Implementation Details
runPHPstep) to execute within a fully booted WordPress contextcurrent_time('timestamp')call that respects the site's timezone settinggenerate-demo-data.phpis the source of truth and can be re-embedded into the JSON via a providedjqcommandhttps://claude.ai/code/session_01DgRcdn1jVhMAUVZBKJQGoJ