├── .github └── workflows │ ├── has-valid-blueprint-json.yml │ ├── postprocess.yml │ └── preview-comment.yml ├── .gitignore ├── .prettierrc ├── CONTRIBUTING.md ├── GALLERY.md ├── GALLERY.md.template ├── README.md ├── blueprints ├── admin-notice │ └── blueprint.json ├── beta-rc │ └── blueprint.json ├── blocky-formats │ └── blueprint.json ├── create-block-theme │ └── blueprint.json ├── custom-post │ ├── blueprint.json │ └── books.php ├── fancy-dashboard_widget │ ├── blueprint.json │ └── custom.php ├── file-starter-content │ ├── blueprint.json │ └── startercontent.php ├── friends-cors │ └── blueprint.json ├── gb-more-experiments │ └── blueprint.json ├── grid-variations │ └── blueprint.json ├── install-activate-setup-theme-from-gh-repo │ ├── blueprint-content.xml │ ├── blueprint.json │ └── images │ │ └── avatars.png ├── install-plugin-from-gist │ └── blueprint.json ├── latest-gutenberg │ └── blueprint.json ├── login-as-editor │ └── blueprint.json ├── posts-via-wp-cli │ └── blueprint.json ├── redirect-upload-requests │ └── blueprint.json ├── reset-data-and-import-content │ ├── blueprint.json │ └── starter-content.xml ├── set-admin-color-scheme │ └── blueprint.json ├── showcase-plugin-with-media │ ├── assets │ │ ├── 2024.zip │ │ ├── makeiteasypopupblock.WordPress.2024-06-20.xml │ │ └── twentytwentyfour-child.zip │ ├── blueprint.json │ └── readme.md ├── stylish-press │ ├── blueprint.json │ ├── site-content.wxr │ ├── stylish-press-theme │ │ ├── functions.php │ │ ├── parts │ │ │ └── header.html │ │ ├── style.css │ │ └── theme.json │ ├── woo-product-images │ │ ├── album-1.jpg │ │ ├── beanie-2.jpg │ │ ├── beanie-with-logo-1.jpg │ │ ├── belt-2.jpg │ │ ├── cap-2.jpg │ │ ├── hoodie-2.jpg │ │ ├── hoodie-blue-1.jpg │ │ ├── hoodie-green-1.jpg │ │ ├── hoodie-with-logo-2.jpg │ │ ├── hoodie-with-pocket-2.jpg │ │ ├── hoodie-with-zipper-2.jpg │ │ ├── logo-1.jpg │ │ ├── long-sleeve-tee-2.jpg │ │ ├── pennant-1.jpg │ │ ├── polo-2.jpg │ │ ├── single-1.jpg │ │ ├── sunglasses-2.jpg │ │ ├── t-shirt-with-logo-1.jpg │ │ ├── tshirt-2.jpg │ │ ├── vnech-tee-blue-1.jpg │ │ ├── vnech-tee-green-1.jpg │ │ └── vneck-tee-2.jpg │ └── woo-products.wxr ├── theme-a11y-test │ └── blueprint.json ├── theme-starter-content │ └── blueprint.json ├── translations │ └── blueprint.json ├── tt5-demo │ ├── blueprint.json │ └── tt5-demo-content.xml ├── use-pretty-permalinks │ └── blueprint.json ├── user-meta │ └── blueprint.json ├── welcome │ ├── README.md │ ├── assets │ │ ├── fonts │ │ │ ├── ebgaramond-regular.ttf │ │ │ └── inter-regular.ttf │ │ └── imgs │ │ │ ├── cover-image-playground-2.webp │ │ │ ├── cover-image-playground.webp │ │ │ ├── playground-logo-150x150.png │ │ │ ├── playground-logo.png │ │ │ ├── thumbnail-playground-1.webp │ │ │ ├── thumbnail-playground-2.webp │ │ │ └── thumbnail-playground-3.webp │ └── blueprint.json ├── woo-shipping │ ├── blueprint.json │ ├── sample_products.xml │ └── woo-shipping-method │ │ └── woo-shipping-method.php ├── woocommerce-product-feed │ └── blueprint.json ├── wpcli-post-with-image │ ├── Select-storage-method.png │ ├── blueprint.json │ └── postcontent.md └── wpgraphql │ └── blueprint.json ├── docs ├── assets │ ├── hello-from-the-dashboard.zip │ ├── installed-adventurer-theme.png │ ├── installed-custom-plugin.png │ └── schema-autocompletion.png ├── build-your-first-blueprint.md ├── how-to-load-run-blueprints.md ├── index.md ├── troubleshoot-debug-blueprints.md └── what-are-blueprints-what-you-can-do-with-them.md ├── index.json ├── reindex_postprocess.py ├── requirements.txt └── validate_pr.py /.github/workflows/has-valid-blueprint-json.yml: -------------------------------------------------------------------------------- 1 | name: Has a valid Blueprint.json file? 2 | 3 | on: 4 | pull_request: 5 | 6 | jobs: 7 | check_blueprints: 8 | runs-on: ubuntu-latest 9 | 10 | env: 11 | GITHUB_BRANCH: ${{ github.event.pull_request.head.ref }} 12 | 13 | steps: 14 | - name: Checkout code 15 | uses: actions/checkout@v2 16 | 17 | - name: Fetch trunk 18 | run: | 19 | git fetch origin trunk 20 | 21 | - name: Install pre-requisites 22 | run: | 23 | pip install -r requirements.txt 24 | 25 | - name: Run validate_pr.py 26 | run: | 27 | python validate_pr.py 28 | -------------------------------------------------------------------------------- /.github/workflows/postprocess.yml: -------------------------------------------------------------------------------- 1 | name: Post-process Blueprints after changes 2 | 3 | on: 4 | push: 5 | branches: 6 | - trunk 7 | 8 | jobs: 9 | build: 10 | runs-on: ubuntu-latest 11 | steps: 12 | - uses: actions/checkout@v2 13 | - name: Set up Python 3.8 14 | uses: actions/setup-python@v2 15 | with: 16 | python-version: 3.8 17 | - name: Install Prettier 18 | run: npm install -g prettier 19 | - name: Run reindex_postprocess.py 20 | run: python reindex_postprocess.py 21 | - name: Run Prettier 22 | run: prettier --write blueprints/**/*.json 23 | - name: Check for uncommitted changes 24 | id: changes 25 | run: | 26 | if [ -z "$(git status --porcelain)" ]; then 27 | echo "No changes" 28 | echo 'CHANGES=0' >> $GITHUB_OUTPUT 29 | else 30 | echo "Changes detected" 31 | echo 'CHANGES=1' >> $GITHUB_OUTPUT 32 | fi 33 | - name: Setup SSH Keys 34 | uses: webfactory/ssh-agent@v0.5.3 35 | with: 36 | ssh-private-key: ${{ secrets.GH_DEPLOY_KEY }} 37 | - name: Push rebuilt WordPress to GitHub 38 | if: steps.changes.outputs.CHANGES == '1' 39 | run: | 40 | git config --global user.name "deployment_bot" 41 | git config --global user.email "deployment_bot@users.noreply.github.com" 42 | git add -A 43 | git commit -a -m "Reindex and reformat Blueprints" 44 | git pull --rebase 45 | if [ $? -eq 0 ]; then 46 | git push git@github.com:${{ github.repository }}.git --follow-tags 47 | fi; 48 | -------------------------------------------------------------------------------- /.github/workflows/preview-comment.yml: -------------------------------------------------------------------------------- 1 | # Responsible for making comments on pull requests, such as commenting for first time contributors. 2 | name: Pull Request Comments 3 | 4 | on: 5 | pull_request_target: 6 | 7 | # Disable permissions for all available scopes by default. 8 | # Any needed permissions should be configured at the job level. 9 | permissions: {} 10 | 11 | jobs: 12 | # Leaves a comment on a pull request with a link to test the changes in a WordPress Playground instance. 13 | playground-details: 14 | name: Comment on a pull request with Playground details 15 | runs-on: ubuntu-latest 16 | permissions: 17 | issues: write 18 | pull-requests: write 19 | steps: 20 | - name: Leave a comment about testing with Playground 21 | uses: actions/github-script@60a0d83039c74a4aee543508d2ffcb1c3799cdea # v7.0.1 22 | with: 23 | script: | 24 | const fs = require( 'fs' ); 25 | const issue_number = context.payload.pull_request.number; 26 | 27 | const prInfo = { 28 | owner: context.repo.owner, 29 | repo: context.repo.repo, 30 | pull_number: issue_number, 31 | }; 32 | 33 | // First, find a blueprint.json file in the pull request 34 | const blueprintFile = ( await github.rest.pulls.listFiles( prInfo ) ).data.filter( file => file.filename.endsWith( '/blueprint.json' ) )[0]; 35 | if ( !blueprintFile ) { 36 | return; 37 | } 38 | 39 | // Comments are only added after the first successful build. Check for the presence of a comment and bail early. 40 | const commentInfo = { 41 | owner: context.repo.owner, 42 | repo: context.repo.repo, 43 | issue_number, 44 | }; 45 | const comments = ( await github.rest.issues.listComments( commentInfo ) ).data; 46 | 47 | for ( const currentComment of comments ) { 48 | if ( currentComment.user.type === 'Bot' && currentComment.body.includes( 'Test using WordPress Playground' ) ) { 49 | commentInfo.comment_id = currentComment.id; 50 | break; 51 | } 52 | }; 53 | 54 | // No comment was found. Create one. 55 | const branch_name = context.payload.pull_request.merged ? context.payload.repository.default_branch : context.payload.pull_request.head.ref; 56 | commentInfo.body = `## Test using WordPress Playground 57 | The changes in this pull request can previewed and tested using a [WordPress Playground](https://developer.wordpress.org/playground/) instance. 58 | 59 | [WordPress Playground](https://developer.wordpress.org/playground/) is an experimental project that creates a full WordPress instance entirely within the browser. 60 | 61 | ### Some things to be aware of 62 | - The Plugin and Theme Directories cannot be accessed within Playground. 63 | - All changes will be lost when closing a tab with a Playground instance. 64 | - All changes will be lost when refreshing the page. 65 | - A fresh instance is created each time the link below is clicked. 66 | - Every time this pull request is updated, a new ZIP file containing all changes is created. If changes are not reflected in the Playground instance, 67 | it's possible that the most recent build failed, or has not completed. Check the [list of workflow runs to be sure](https://github.com/WordPress/wordpress-develop/actions/workflows/wordpress-playground.yml). 68 | 69 | For more details about these limitations and more, check out the [Limitations page](https://wordpress.github.io/wordpress-playground/limitations/) in the WordPress Playground documentation. 70 | 71 | [Test this pull request with WordPress Playground](https://playground.wordpress.net/?blueprint-url=https://raw.githubusercontent.com/${ context.payload.pull_request.head.repo.owner.login }/${ context.payload.pull_request.head.repo.name }/${ branch_name }/${ blueprintFile.filename }). 72 | `; 73 | 74 | if ( commentInfo.comment_id ) { 75 | await github.rest.issues.updateComment( commentInfo ); 76 | } else { 77 | await github.rest.issues.createComment( commentInfo ); 78 | } 79 | -------------------------------------------------------------------------------- /.gitignore: -------------------------------------------------------------------------------- 1 | # macOS system files 2 | .DS_Store 3 | 4 | # Windows system files 5 | Thumbs.db 6 | ehthumbs.db 7 | Desktop.ini 8 | 9 | # Node modules 10 | node_modules/ 11 | 12 | # Logs 13 | npm-debug.log* 14 | yarn-debug.log* 15 | yarn-error.log* 16 | 17 | # Environment files 18 | .env 19 | .env.* 20 | 21 | # Editor directories and files 22 | .vscode/ 23 | .idea/ 24 | *.sublime-workspace 25 | *.sublime-project 26 | 27 | # OS generated files 28 | *.swp 29 | *.bak 30 | *.tmp 31 | -------------------------------------------------------------------------------- /.prettierrc: -------------------------------------------------------------------------------- 1 | { 2 | "tabWidth": 4, 3 | "useTabs": true 4 | } 5 | -------------------------------------------------------------------------------- /CONTRIBUTING.md: -------------------------------------------------------------------------------- 1 | # Contribution Guidelines 2 | 3 | We encourage you to contribute your own Blueprints to this repository! 4 | 5 | ## Build your first Blueprint 6 | 7 | Not sure how? Check out the [Blueprints 101](./docs/index.md). 8 | 9 | ## Submit your Blueprint to this repository 10 | 11 | To keep the submission process smooth, please follow these guidelines: 12 | 13 | Submit [a Pull Request (PR)](https://github.com/adamziel/blueprints/pulls) with your Blueprint. Consult this page [Creating a pull request](https://docs.github.com/en/pull-requests/collaborating-with-pull-requests/proposing-changes-to-your-work-with-pull-requests/creating-a-pull-request) if you need a refresher on the process. 14 | 15 | The PR should contain: 16 | 17 | * A single `blueprint.json` file under the path `blueprints/your-blueprint-name/blueprint.json` (like [the examples here](https://github.com/wordpress/blueprints/tree/trunk/blueprints)). 18 | * All the static files (WXR, ZIP, JPG, etc.) your Blueprint references. The static files must be loaded via the `https://raw.githubusercontent.com` URL pointing to your branch. `raw.githubusercontent.com` is a service that allows you to serve files directly from your GitHub repository. This is useful for loading static files in Blueprints. The URLs follow the `raw.githubusercontent.com/${user}/${repo}/${branch}/${path}` pattern. 19 | 20 | For example, if you want to load a content-export.xml file, you create a new folder in the blueprints directory, /woocommerce-subscription (the name should correpond to the name of the blueprint). The folder must hold two files: 21 | 22 | * A `blueprints/woocommerce-subscriptions/blueprint.json` file 23 | * A `blueprints/woocommerce-subscription/content-export.xml` file 24 | 25 | Assuming your branch is named `/woo-subscription/`, the Blueprint should reference as follows: 26 | 27 | ```json 28 | { 29 | "steps": [ 30 | { 31 | "step": "importWxr", 32 | "file": { 33 | "resource": "url", 34 | "url": "https://raw.githubusercontent.com/wordpress/blueprints/woo-subscriptions/blueprints/woocommerce-subscriptions/content-export.xml" 35 | } 36 | } 37 | ] 38 | } 39 | ``` 40 | 41 | By submitting a Blueprint, you agree to license it under [GPLv2 or later license](https://www.gnu.org/licenses/old-licenses/gpl-2.0.en.html). 42 | 43 | Make sure to correctly indent your Blueprints using tabs using a code formatter like [Prettier](https://prettier.io/). This repository ships a `.prettierrc` file you could use. This is mostly to help the reviewers understand your Blueprint better. Every accepted and merged Blueprint will automatically be re-formatted using the `.prettierrc` file. 44 | 45 | ## Blueprint metadata 46 | 47 | Each Blueprint should include metadata within the top-level "meta" key of the `blueprint.json` file. Note that metadata is not required for all Blueprints, only for Blueprints submitted to this gallery. 48 | 49 | Here's what's required: 50 | 51 | - **Title:** a clear and concise name for your Blueprint. 52 | - **Author:** your GitHub username, to let others know who created the Blueprint. 53 | 54 | Optionally, you can add: 55 | 56 | - **Description:** a brief explanation of what the Blueprint offers. 57 | - **Categories:** specify relevant categories to help users find your Blueprint in the future Blueprints section on WordPress.org. 58 | 59 | Here's an example: 60 | 61 | ```json 62 | { 63 | "meta": { 64 | "title": "WooCommerce Developer Environment", 65 | "description": "A local development environment for WooCommerce that includes WP-CLI.", 66 | "author": "zieladam", 67 | "categories": ["woocommerce", "developer environment"] 68 | } 69 | } 70 | ``` 71 | 72 | ## Need help? 73 | 74 | If you have questions or comments, [open a new issue](https://github.com/wordpress/blueprints/issues) in this repository. 75 | -------------------------------------------------------------------------------- /GALLERY.md: -------------------------------------------------------------------------------- 1 | # WordPress Blueprints Gallery 2 | 3 | Here's the list of all the community Blueprints submitted to this repository. See the [contribution guidelines](./README.md#contributing-your-blueprint) to submit your Blueprint and share your WordPress setup with the world! 4 | 5 | | Title | Description | Author | Actions | 6 | | ----- | ----------- | ------ | ------- | 7 | | **Feed Reader with the Friends Plugin** | By using the Friends plugin, you can read feeds from the web in Playground, and even via ActivityPub | [@akirk](https://github.com/akirk) | • [Open in Playground](https://playground.wordpress.net/?blueprint-url=https://raw.githubusercontent.com/wordpress/blueprints/trunk/blueprints/friends-cors/blueprint.json)
• [View source](https://github.com/wordpress/blueprints/blob/trunk/blueprints/friends-cors/blueprint.json)
• [Edit](https://playground.wordpress.net/builder/builder.html?blueprint-url=https://raw.githubusercontent.com/wordpress/blueprints/trunk/blueprints/friends-cors/blueprint.json) | 8 | | **Stylish Press** | A Woo store with custom theme, content, and products. | [@adamziel](https://github.com/adamziel) | • [Open in Playground](https://playground.wordpress.net/?blueprint-url=https://raw.githubusercontent.com/wordpress/blueprints/trunk/blueprints/stylish-press/blueprint.json)
• [View source](https://github.com/wordpress/blueprints/blob/trunk/blueprints/stylish-press/blueprint.json)
• [Edit](https://playground.wordpress.net/builder/builder.html?blueprint-url=https://raw.githubusercontent.com/wordpress/blueprints/trunk/blueprints/stylish-press/blueprint.json) | 9 | | Create Block Theme | Blueprint to install Create Block Theme and start editing right away | [@jonathanbossenger](https://github.com/jonathanbossenger) | • [Open in Playground](https://playground.wordpress.net/?blueprint-url=https://raw.githubusercontent.com/wordpress/blueprints/trunk/blueprints/create-block-theme/blueprint.json)
• [View source](https://github.com/wordpress/blueprints/blob/trunk/blueprints/create-block-theme/blueprint.json)
• [Edit](https://playground.wordpress.net/builder/builder.html?blueprint-url=https://raw.githubusercontent.com/wordpress/blueprints/trunk/blueprints/create-block-theme/blueprint.json) | 10 | | Creating a new user for the blog | This is a simple example to update user meta data | [@fellyph](https://github.com/fellyph) | • [Open in Playground](https://playground.wordpress.net/?blueprint-url=https://raw.githubusercontent.com/wordpress/blueprints/trunk/blueprints/user-meta/blueprint.json)
• [View source](https://github.com/wordpress/blueprints/blob/trunk/blueprints/user-meta/blueprint.json)
• [Edit](https://playground.wordpress.net/builder/builder.html?blueprint-url=https://raw.githubusercontent.com/wordpress/blueprints/trunk/blueprints/user-meta/blueprint.json) | 11 | | Custom Post Type: Books | Blueprint that added a custom post type to playground | [@bph](https://github.com/bph) | • [Open in Playground](https://playground.wordpress.net/?blueprint-url=https://raw.githubusercontent.com/wordpress/blueprints/trunk/blueprints/custom-post/blueprint.json)
• [View source](https://github.com/wordpress/blueprints/blob/trunk/blueprints/custom-post/blueprint.json)
• [Edit](https://playground.wordpress.net/builder/builder.html?blueprint-url=https://raw.githubusercontent.com/wordpress/blueprints/trunk/blueprints/custom-post/blueprint.json) | 12 | | Demo of Twenty-Twenty-Five theme | Blueprint with demo content for the Twenty-Twenty-Five default theme | [@bph](https://github.com/bph) | • [Open in Playground](https://playground.wordpress.net/?blueprint-url=https://raw.githubusercontent.com/wordpress/blueprints/trunk/blueprints/tt5-demo/blueprint.json)
• [View source](https://github.com/wordpress/blueprints/blob/trunk/blueprints/tt5-demo/blueprint.json)
• [Edit](https://playground.wordpress.net/builder/builder.html?blueprint-url=https://raw.githubusercontent.com/wordpress/blueprints/trunk/blueprints/tt5-demo/blueprint.json) | 13 | | Display Admin Notice | Blueprint to add a tiny mu-plugin and display an admin notice | [@bph](https://github.com/bph) | • [Open in Playground](https://playground.wordpress.net/?blueprint-url=https://raw.githubusercontent.com/wordpress/blueprints/trunk/blueprints/admin-notice/blueprint.json)
• [View source](https://github.com/wordpress/blueprints/blob/trunk/blueprints/admin-notice/blueprint.json)
• [Edit](https://playground.wordpress.net/builder/builder.html?blueprint-url=https://raw.githubusercontent.com/wordpress/blueprints/trunk/blueprints/admin-notice/blueprint.json) | 14 | | Enable all three Dataview Experiments in Gutenberg | Blueprint example to enable multiple Experiments within the Gutenberg plugin | [@bph](https://github.com/bph) | • [Open in Playground](https://playground.wordpress.net/?blueprint-url=https://raw.githubusercontent.com/wordpress/blueprints/trunk/blueprints/gb-more-experiments/blueprint.json)
• [View source](https://github.com/wordpress/blueprints/blob/trunk/blueprints/gb-more-experiments/blueprint.json)
• [Edit](https://playground.wordpress.net/builder/builder.html?blueprint-url=https://raw.githubusercontent.com/wordpress/blueprints/trunk/blueprints/gb-more-experiments/blueprint.json) | 15 | | Fancy Dashboard Widget | A blueprint to display statistics about users, posts and comments on a WordPress site. | [@muryamsultana](https://github.com/muryamsultana) | • [Open in Playground](https://playground.wordpress.net/?blueprint-url=https://raw.githubusercontent.com/wordpress/blueprints/trunk/blueprints/fancy-dashboard_widget/blueprint.json)
• [View source](https://github.com/wordpress/blueprints/blob/trunk/blueprints/fancy-dashboard_widget/blueprint.json)
• [Edit](https://playground.wordpress.net/builder/builder.html?blueprint-url=https://raw.githubusercontent.com/wordpress/blueprints/trunk/blueprints/fancy-dashboard_widget/blueprint.json) | 16 | | Grid Variations Experiments enabled | Blueprint example to toggle on enable a feature from the Experiments page in Gutenberg plugin | [@bph](https://github.com/bph) | • [Open in Playground](https://playground.wordpress.net/?blueprint-url=https://raw.githubusercontent.com/wordpress/blueprints/trunk/blueprints/grid-variations/blueprint.json)
• [View source](https://github.com/wordpress/blueprints/blob/trunk/blueprints/grid-variations/blueprint.json)
• [Edit](https://playground.wordpress.net/builder/builder.html?blueprint-url=https://raw.githubusercontent.com/wordpress/blueprints/trunk/blueprints/grid-variations/blueprint.json) | 17 | | Import Theme Starter Content | Blueprint to install a theme with starter content, (here: Twenty-Twenty-One) | [@bph](https://github.com/bph) | • [Open in Playground](https://playground.wordpress.net/?blueprint-url=https://raw.githubusercontent.com/wordpress/blueprints/trunk/blueprints/theme-starter-content/blueprint.json)
• [View source](https://github.com/wordpress/blueprints/blob/trunk/blueprints/theme-starter-content/blueprint.json)
• [Edit](https://playground.wordpress.net/builder/builder.html?blueprint-url=https://raw.githubusercontent.com/wordpress/blueprints/trunk/blueprints/theme-starter-content/blueprint.json) | 18 | | Import a standalone starter content via a blueprint step | Blueprint to use a stand-alone starter content file and then to import it. Click on 'Subscriptions' | [@bph](https://github.com/bph) | • [Open in Playground](https://playground.wordpress.net/?blueprint-url=https://raw.githubusercontent.com/wordpress/blueprints/trunk/blueprints/file-starter-content/blueprint.json)
• [View source](https://github.com/wordpress/blueprints/blob/trunk/blueprints/file-starter-content/blueprint.json)
• [Edit](https://playground.wordpress.net/builder/builder.html?blueprint-url=https://raw.githubusercontent.com/wordpress/blueprints/trunk/blueprints/file-starter-content/blueprint.json) | 19 | | Install WordPress language packs | Installs and activates the latest WordPress Japanese translation pack from https://translate.wordpress.org/ – both for WordPress core and for the friends plugin. | [@adamziel](https://github.com/adamziel) | • [Open in Playground](https://playground.wordpress.net/?blueprint-url=https://raw.githubusercontent.com/wordpress/blueprints/trunk/blueprints/translations/blueprint.json)
• [View source](https://github.com/wordpress/blueprints/blob/trunk/blueprints/translations/blueprint.json)
• [Edit](https://playground.wordpress.net/builder/builder.html?blueprint-url=https://raw.githubusercontent.com/wordpress/blueprints/trunk/blueprints/translations/blueprint.json) | 20 | | Install plugin from a gist | Install and activate a WordPress plugin from a .php file stored in a gist. | [@zieladam](https://github.com/zieladam) | • [Open in Playground](https://playground.wordpress.net/?blueprint-url=https://raw.githubusercontent.com/wordpress/blueprints/trunk/blueprints/install-plugin-from-gist/blueprint.json)
• [View source](https://github.com/wordpress/blueprints/blob/trunk/blueprints/install-plugin-from-gist/blueprint.json)
• [Edit](https://playground.wordpress.net/builder/builder.html?blueprint-url=https://raw.githubusercontent.com/wordpress/blueprints/trunk/blueprints/install-plugin-from-gist/blueprint.json) | 21 | | Latest Gutenberg plugin | A preview of the latest version of the Gutenberg plugin. | [@zieladam](https://github.com/zieladam) | • [Open in Playground](https://playground.wordpress.net/?blueprint-url=https://raw.githubusercontent.com/wordpress/blueprints/trunk/blueprints/latest-gutenberg/blueprint.json)
• [View source](https://github.com/wordpress/blueprints/blob/trunk/blueprints/latest-gutenberg/blueprint.json)
• [Edit](https://playground.wordpress.net/builder/builder.html?blueprint-url=https://raw.githubusercontent.com/wordpress/blueprints/trunk/blueprints/latest-gutenberg/blueprint.json) | 22 | | Loading, activating, and configuring a theme from a GitHub repository. | This is a good example of typical steps used on a theme's loading, activation and configuration | [@richtabor](https://github.com/richtabor) | • [Open in Playground](https://playground.wordpress.net/?blueprint-url=https://raw.githubusercontent.com/wordpress/blueprints/trunk/blueprints/install-activate-setup-theme-from-gh-repo/blueprint.json)
• [View source](https://github.com/wordpress/blueprints/blob/trunk/blueprints/install-activate-setup-theme-from-gh-repo/blueprint.json)
• [Edit](https://playground.wordpress.net/builder/builder.html?blueprint-url=https://raw.githubusercontent.com/wordpress/blueprints/trunk/blueprints/install-activate-setup-theme-from-gh-repo/blueprint.json) | 23 | | Login as an editor | Test WordPress functionality as an editor rather than an administrator. | [@bacoords](https://github.com/bacoords) | • [Open in Playground](https://playground.wordpress.net/?blueprint-url=https://raw.githubusercontent.com/wordpress/blueprints/trunk/blueprints/login-as-editor/blueprint.json)
• [View source](https://github.com/wordpress/blueprints/blob/trunk/blueprints/login-as-editor/blueprint.json)
• [Edit](https://playground.wordpress.net/builder/builder.html?blueprint-url=https://raw.githubusercontent.com/wordpress/blueprints/trunk/blueprints/login-as-editor/blueprint.json) | 24 | | Markdown and Trac Syntax Editor | Edit Markdown and Trac formatting in the block editor thanks to the blocky-formats plugin! | [@adamziel](https://github.com/adamziel) | • [Open in Playground](https://playground.wordpress.net/?blueprint-url=https://raw.githubusercontent.com/wordpress/blueprints/trunk/blueprints/blocky-formats/blueprint.json)
• [View source](https://github.com/wordpress/blueprints/blob/trunk/blueprints/blocky-formats/blueprint.json)
• [Edit](https://playground.wordpress.net/builder/builder.html?blueprint-url=https://raw.githubusercontent.com/wordpress/blueprints/trunk/blueprints/blocky-formats/blueprint.json) | 25 | | Minimal WooCommerce Setup with Sample Products, Shipping, and Payment Method | To create a WordPress Playground instance that installs WooCommerce, adds a custom flat rate shipping method via a plugin, imports WooCommerce sample products XML to demonstrate the shipping method on the cart/checkout pages, and enables the Direct Bank Transfer payment method. | [@calvinrodrigues500](https://github.com/calvinrodrigues500) | • [Open in Playground](https://playground.wordpress.net/?blueprint-url=https://raw.githubusercontent.com/wordpress/blueprints/trunk/blueprints/woo-shipping/blueprint.json)
• [View source](https://github.com/wordpress/blueprints/blob/trunk/blueprints/woo-shipping/blueprint.json)
• [Edit](https://playground.wordpress.net/builder/builder.html?blueprint-url=https://raw.githubusercontent.com/wordpress/blueprints/trunk/blueprints/woo-shipping/blueprint.json) | 26 | | Playground Welcome Landing Page | Landing page for the WordPress Playground giving a quick overview of the features and capabilities of the platform. | [@fellyph](https://github.com/fellyph) | • [Open in Playground](https://playground.wordpress.net/?blueprint-url=https://raw.githubusercontent.com/wordpress/blueprints/trunk/blueprints/welcome/blueprint.json)
• [View source](https://github.com/wordpress/blueprints/blob/trunk/blueprints/welcome/blueprint.json)
• [Edit](https://playground.wordpress.net/builder/builder.html?blueprint-url=https://raw.githubusercontent.com/wordpress/blueprints/trunk/blueprints/welcome/blueprint.json) | 27 | | Pretty permalinks | Set the permalink structure to use pretty permalinks. | [@bgrgicak](https://github.com/bgrgicak) | • [Open in Playground](https://playground.wordpress.net/?blueprint-url=https://raw.githubusercontent.com/wordpress/blueprints/trunk/blueprints/use-pretty-permalinks/blueprint.json)
• [View source](https://github.com/wordpress/blueprints/blob/trunk/blueprints/use-pretty-permalinks/blueprint.json)
• [Edit](https://playground.wordpress.net/builder/builder.html?blueprint-url=https://raw.githubusercontent.com/wordpress/blueprints/trunk/blueprints/use-pretty-permalinks/blueprint.json) | 28 | | Reset data and import content (with logs) | It resets default data before importing custom content. It also logs the state of the content after each step. | [@juanmaguitar](https://github.com/juanmaguitar) | • [Open in Playground](https://playground.wordpress.net/?blueprint-url=https://raw.githubusercontent.com/wordpress/blueprints/trunk/blueprints/reset-data-and-import-content/blueprint.json)
• [View source](https://github.com/wordpress/blueprints/blob/trunk/blueprints/reset-data-and-import-content/blueprint.json)
• [Edit](https://playground.wordpress.net/builder/builder.html?blueprint-url=https://raw.githubusercontent.com/wordpress/blueprints/trunk/blueprints/reset-data-and-import-content/blueprint.json) | 29 | | Serve media files from another host | Redirect any requests to files within the uploads directory to an external host. This is useful when you have a lot of image attachments in your playground but don’t want to include them all in the blueprint. | [@ivanblagdan](https://github.com/ivanblagdan) | • [Open in Playground](https://playground.wordpress.net/?blueprint-url=https://raw.githubusercontent.com/wordpress/blueprints/trunk/blueprints/redirect-upload-requests/blueprint.json)
• [View source](https://github.com/wordpress/blueprints/blob/trunk/blueprints/redirect-upload-requests/blueprint.json)
• [Edit](https://playground.wordpress.net/builder/builder.html?blueprint-url=https://raw.githubusercontent.com/wordpress/blueprints/trunk/blueprints/redirect-upload-requests/blueprint.json) | 30 | | Set the admin color scheme | Set the admin color scheme to Modern using the updateUserMeta step. | [@ndiego](https://github.com/ndiego) | • [Open in Playground](https://playground.wordpress.net/?blueprint-url=https://raw.githubusercontent.com/wordpress/blueprints/trunk/blueprints/set-admin-color-scheme/blueprint.json)
• [View source](https://github.com/wordpress/blueprints/blob/trunk/blueprints/set-admin-color-scheme/blueprint.json)
• [Edit](https://playground.wordpress.net/builder/builder.html?blueprint-url=https://raw.githubusercontent.com/wordpress/blueprints/trunk/blueprints/set-admin-color-scheme/blueprint.json) | 31 | | Showcase plugin | Showcase custom plugin from own server with media files and content imported as WXR. There is a readme file in github repository (https://github.com/Lovor01/blueprints/blob/trunk/blueprints/showcase-plugin-with-media/readme.md) which explains all steps. | [@Lovor01](https://github.com/Lovor01) | • [Open in Playground](https://playground.wordpress.net/?blueprint-url=https://raw.githubusercontent.com/wordpress/blueprints/trunk/blueprints/showcase-plugin-with-media/blueprint.json)
• [View source](https://github.com/wordpress/blueprints/blob/trunk/blueprints/showcase-plugin-with-media/blueprint.json)
• [Edit](https://playground.wordpress.net/builder/builder.html?blueprint-url=https://raw.githubusercontent.com/wordpress/blueprints/trunk/blueprints/showcase-plugin-with-media/blueprint.json) | 32 | | Theme Tester | Blueprint example to add content and plugins to explore a theme | [@bph](https://github.com/bph) | • [Open in Playground](https://playground.wordpress.net/?blueprint-url=https://raw.githubusercontent.com/wordpress/blueprints/trunk/blueprints/theme-a11y-test/blueprint.json)
• [View source](https://github.com/wordpress/blueprints/blob/trunk/blueprints/theme-a11y-test/blueprint.json)
• [Edit](https://playground.wordpress.net/builder/builder.html?blueprint-url=https://raw.githubusercontent.com/wordpress/blueprints/trunk/blueprints/theme-a11y-test/blueprint.json) | 33 | | Use WPGraphQL to query WordPress | Example that loads WordPress with WPGraphQL active and defaults to the WPGraphQL IDE page to allow users to test GraphQL queries and explore the GraphQL Schema. | [@jasonbahl](https://github.com/jasonbahl) | • [Open in Playground](https://playground.wordpress.net/?blueprint-url=https://raw.githubusercontent.com/wordpress/blueprints/trunk/blueprints/wpgraphql/blueprint.json)
• [View source](https://github.com/wordpress/blueprints/blob/trunk/blueprints/wpgraphql/blueprint.json)
• [Edit](https://playground.wordpress.net/builder/builder.html?blueprint-url=https://raw.githubusercontent.com/wordpress/blueprints/trunk/blueprints/wpgraphql/blueprint.json) | 34 | | Use wp-cli command to add posts | Blueprint example to add posts via a wp-cli command. | [@bph](https://github.com/bph) | • [Open in Playground](https://playground.wordpress.net/?blueprint-url=https://raw.githubusercontent.com/wordpress/blueprints/trunk/blueprints/posts-via-wp-cli/blueprint.json)
• [View source](https://github.com/wordpress/blueprints/blob/trunk/blueprints/posts-via-wp-cli/blueprint.json)
• [Edit](https://playground.wordpress.net/builder/builder.html?blueprint-url=https://raw.githubusercontent.com/wordpress/blueprints/trunk/blueprints/posts-via-wp-cli/blueprint.json) | 35 | | Use wp-cli to add a post with image | Use wp-cli to create a post from text file with block markup and a featured image | [@bph](https://github.com/bph) | • [Open in Playground](https://playground.wordpress.net/?blueprint-url=https://raw.githubusercontent.com/wordpress/blueprints/trunk/blueprints/wpcli-post-with-image/blueprint.json)
• [View source](https://github.com/wordpress/blueprints/blob/trunk/blueprints/wpcli-post-with-image/blueprint.json)
• [Edit](https://playground.wordpress.net/builder/builder.html?blueprint-url=https://raw.githubusercontent.com/wordpress/blueprints/trunk/blueprints/wpcli-post-with-image/blueprint.json) | 36 | | WooCommerce product feed | Blueprint to create a WooCommerce product and export an XML/CSV product feed | [@mujuonly](https://github.com/mujuonly) | • [Open in Playground](https://playground.wordpress.net/?blueprint-url=https://raw.githubusercontent.com/wordpress/blueprints/trunk/blueprints/woocommerce-product-feed/blueprint.json)
• [View source](https://github.com/wordpress/blueprints/blob/trunk/blueprints/woocommerce-product-feed/blueprint.json)
• [Edit](https://playground.wordpress.net/builder/builder.html?blueprint-url=https://raw.githubusercontent.com/wordpress/blueprints/trunk/blueprints/woocommerce-product-feed/blueprint.json) | 37 | | WordPress Beta | Test the latest WordPress Beta or RC release with theme test data and debugging plugins. Only loads the Beta version during the Beta period. | [@courtneyr-dev](https://github.com/courtneyr-dev) | • [Open in Playground](https://playground.wordpress.net/?blueprint-url=https://raw.githubusercontent.com/wordpress/blueprints/trunk/blueprints/beta-rc/blueprint.json)
• [View source](https://github.com/wordpress/blueprints/blob/trunk/blueprints/beta-rc/blueprint.json)
• [Edit](https://playground.wordpress.net/builder/builder.html?blueprint-url=https://raw.githubusercontent.com/wordpress/blueprints/trunk/blueprints/beta-rc/blueprint.json) | 38 | 39 | -------------------------------------------------------------------------------- /GALLERY.md.template: -------------------------------------------------------------------------------- 1 | # WordPress Blueprints Gallery 2 | 3 | Here's the list of all the community Blueprints submitted to this repository. See the [contribution guidelines](./README.md#contributing-your-blueprint) to submit your Blueprint and share your WordPress setup with the world! 4 | 5 | {BLUEPRINTS_TABLE} 6 | 7 | -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | # WordPress Blueprints Community Gallery 2 | 3 | > [!IMPORTANT] 4 | > Skip to the Blueprints Gallery to explore a variety of WordPress sites. Keep reading to learn more about Blueprints and how to contribute your own: 5 | > 6 | > [
 Browse the Blueprints Gallery 
](./GALLERY.md) 7 | 8 | ## What are Blueprints? 9 | 10 | Blueprints are WordPress setup scripts that you can preview live in [WordPress Playground](https://w.org/playground). Blueprints contain all the installation instructions needed to setup WordPress, including plugins, themes, site options, starter content to import, and more. 11 | 12 | The basic example below will load a Playground instance with the Hello Dolly plugin preinstalled and that opens in wp-admin plugins screen after it automattically logs in. 13 | 14 | ```json 15 | { 16 | "plugins": ["hello-dolly", "gutenberg"], 17 | "login": true, 18 | "landingPage": "/wp-admin/plugins.php" 19 | } 20 | ``` 21 | [
 Preview in WordPress Playground 
](https://playground.wordpress.net/#%7B%22plugins%22:%5B%22hello-dolly%22,%22gutenberg%22%5D,%20%22login%22:%20true,%20%22landingPage%22:%20%22/wp-admin/plugins.php%22%20%7D) 22 | 23 | Check out [Blueprints 101](./docs/index.md) to get started creating blueprints. 24 | 25 | 26 | ## Why use Blueprints? 27 | 28 | Blueprints can help you 29 | 30 | - **Explore different setups:** try out different themes and plugins without the risk of breaking your site. It's a safe environment to see what works best for your needs. 31 | - **Save time**: instead of manually setting up your site, choosing themes, and installing plugins one by one, Blueprints do all of the work for you. 32 | - **Learn WordPress:** Blueprints are a fantastic way to play with a variety of WordPress configurations. 33 | 34 | ## Ready to jump in? 35 | 36 | This community space allows you to 37 | 38 | * [Browse the Blueprints Gallery](./GALLERY.md) and explore diverse WordPress sites and different configurations. 39 | * [Submit your own Blueprint](./CONTRIBUTING.md) and share your WordPress setup with the community. 40 | 41 | ## How to contribute your Blueprint 42 | 43 | We encourage you to contribute your Blueprints to this repository! We accepet new submissions as Pull Requests. Read the [Contributing Guidelines](./CONTRIBUTING.md) for more details. 44 | 45 | ## Need help? 46 | 47 | If you have questions or comments, [open a new issue](https://github.com/wordpress/blueprints/issues) in this repository. 48 | 49 | ## Let's build the Blueprint Community together! 50 | 51 | This is a minimal version 1 (v1) to get the community space up and running. We plan to build upon this foundation, expand, and improve it—with your feedback. So, explore, create, and share your Blueprints! 52 | -------------------------------------------------------------------------------- /blueprints/admin-notice/blueprint.json: -------------------------------------------------------------------------------- 1 | { 2 | "$schema": "https://playground.wordpress.net/blueprint-schema.json", 3 | "meta": { 4 | "title": "Display Admin Notice ", 5 | "description": "Blueprint to add a tiny mu-plugin and display an admin notice", 6 | "author": "bph", 7 | "categories": ["Admin", "notices"] 8 | }, 9 | "landingPage": "/wp-admin/plugins.php", 10 | "login": true, 11 | "steps": [ 12 | { 13 | "step": "writeFile", 14 | "path": "/wordpress/wp-content/mu-plugins/bgnightly-notice.php", 15 | "data": "

Hello from Playground.

'; });" 16 | } 17 | ] 18 | } 19 | -------------------------------------------------------------------------------- /blueprints/beta-rc/blueprint.json: -------------------------------------------------------------------------------- 1 | { 2 | "$schema": "https://playground.wordpress.net/blueprint-schema.json", 3 | "meta": { 4 | "title": "WordPress Beta", 5 | "description": "Test the latest WordPress Beta or RC release with theme test data and debugging plugins. Only loads the Beta version during the Beta period.", 6 | "author": "courtneyr-dev", 7 | "categories": ["Testing"] 8 | }, 9 | "preferredVersions": { 10 | "php": "8.3", 11 | "wp": "beta" 12 | }, 13 | "steps": [ 14 | { 15 | "step": "login", 16 | "username": "admin", 17 | "password": "password" 18 | }, 19 | { 20 | "step": "importWxr", 21 | "file": { 22 | "resource": "url", 23 | "url": "https://raw.githubusercontent.com/wpaccessibility/a11y-theme-unit-test/master/a11y-theme-unit-test-data.xml" 24 | } 25 | }, 26 | { 27 | "step": "importWxr", 28 | "file": { 29 | "resource": "url", 30 | "url": "https://raw.githubusercontent.com/WordPress/theme-test-data/master/themeunittestdata.wordpress.xml" 31 | } 32 | }, 33 | { 34 | "step": "installPlugin", 35 | "pluginZipFile": { 36 | "resource": "wordpress.org/plugins", 37 | "slug": "query-monitor" 38 | }, 39 | "options": { 40 | "activate": false 41 | }, 42 | "progress": { 43 | "weight": 2 44 | } 45 | }, 46 | { 47 | "step": "installPlugin", 48 | "pluginZipFile": { 49 | "resource": "wordpress.org/plugins", 50 | "slug": "create-block-theme" 51 | }, 52 | "progress": { 53 | "weight": 2 54 | } 55 | }, 56 | { 57 | "step": "installPlugin", 58 | "pluginZipFile": { 59 | "resource": "wordpress.org/plugins", 60 | "slug": "debug-bar" 61 | }, 62 | "progress": { 63 | "weight": 2 64 | } 65 | }, 66 | { 67 | "step": "installPlugin", 68 | "pluginZipFile": { 69 | "resource": "wordpress.org/plugins", 70 | "slug": "health-check" 71 | }, 72 | "progress": { 73 | "weight": 2 74 | } 75 | }, 76 | { 77 | "step": "installPlugin", 78 | "pluginZipFile": { 79 | "resource": "wordpress.org/plugins", 80 | "slug": "test-reports" 81 | }, 82 | "progress": { 83 | "weight": 2 84 | } 85 | }, 86 | { 87 | "step": "installPlugin", 88 | "pluginZipFile": { 89 | "resource": "wordpress.org/plugins", 90 | "slug": "user-switching" 91 | }, 92 | "progress": { 93 | "weight": 2 94 | } 95 | } 96 | ] 97 | } 98 | -------------------------------------------------------------------------------- /blueprints/blocky-formats/blueprint.json: -------------------------------------------------------------------------------- 1 | { 2 | "$schema": "https://playground.wordpress.net/blueprint-schema.json", 3 | "meta": { 4 | "title": "Markdown and Trac Syntax Editor", 5 | "description": "Edit Markdown and Trac formatting in the block editor thanks to the blocky-formats plugin!", 6 | "author": "adamziel", 7 | "categories": ["block-editor"] 8 | }, 9 | "login": true, 10 | "landingPage": "/wp-admin/post-new.php", 11 | "steps": [ 12 | { 13 | "step": "installPlugin", 14 | "options": { 15 | "activate": true, 16 | "targetFolderName": "blocky-formats" 17 | }, 18 | "pluginData": { 19 | "resource": "git:directory", 20 | "url": "https://github.com/dmsnell/blocky-formats.git", 21 | "ref": "HEAD", 22 | "path": "/" 23 | } 24 | } 25 | ] 26 | } 27 | -------------------------------------------------------------------------------- /blueprints/create-block-theme/blueprint.json: -------------------------------------------------------------------------------- 1 | { 2 | "$schema": "https://playground.wordpress.net/blueprint-schema.json", 3 | "meta": { 4 | "title": "Create Block Theme", 5 | "description": "Blueprint to install Create Block Theme and start editing right away", 6 | "author": "jonathanbossenger", 7 | "categories": ["Editor", "theme"] 8 | }, 9 | "plugins": ["create-block-theme"], 10 | "login": true, 11 | "landingPage": "/wp-admin/site-editor.php" 12 | } 13 | -------------------------------------------------------------------------------- /blueprints/custom-post/blueprint.json: -------------------------------------------------------------------------------- 1 | { 2 | "$schema": "https://playground.wordpress.net/blueprint-schema.json", 3 | "meta": { 4 | "title": "Custom Post Type: Books", 5 | "description": "Blueprint that added a custom post type to playground", 6 | "author": "bph", 7 | "categories": ["Content", "CPT"] 8 | }, 9 | "landingPage": "/wp-admin/edit.php?post_type=gbtbooks", 10 | "login": true, 11 | "steps": [ 12 | { 13 | "step": "mkdir", 14 | "path": "/wordpress/wp-content/plugins/books" 15 | }, 16 | { 17 | "step": "writeFile", 18 | "path": "/wordpress/wp-content/plugins/books/books.php", 19 | "data": { 20 | "resource": "url", 21 | "url": "https://github.com/WordPress/blueprints/blob/trunk/blueprints/custom-post/books.php" 22 | } 23 | }, 24 | { 25 | "step": "activatePlugin", 26 | "pluginPath": "books/books.php" 27 | }, 28 | { 29 | "step": "wp-cli", 30 | "command": "wp post create --post_type=gbtbooks --post_title='WordPress Styling with Blocks, Patterns, Templates, and Themes' --post_content='

Explore WordPress styling with step-by-step guidance, practical examples, and tips by Tammie Lister

' --post_status=publish" 31 | }, 32 | { 33 | "step": "updateUserMeta", 34 | "meta": { 35 | "admin_color": "modern" 36 | }, 37 | "userId": 1 38 | } 39 | ] 40 | } 41 | -------------------------------------------------------------------------------- /blueprints/custom-post/books.php: -------------------------------------------------------------------------------- 1 | _x( 'Books', 'Post Type General Name', 'gbt' ), 24 | 'singular_name' => _x( 'Book', 'Post Type Singular Name', 'gbt' ), 25 | 'menu_name' => __( 'Books', 'gbt' ), 26 | 'name_admin_bar' => __( 'Books', 'gbt' ), 27 | 'archives' => __( 'Book Archives', 'gbt' ), 28 | 'attributes' => __( 'Book Attributes', 'gbt' ), 29 | 'parent_item_colon' => __( 'Parent book', 'gbt' ), 30 | 'all_items' => __( 'All Books', 'gbt' ), 31 | 'add_new_item' => __( 'Add New Book', 'gbt' ), 32 | 'add_new' => __( 'Add New Book', 'gbt' ), 33 | 'new_item' => __( 'New Book', 'gbt' ), 34 | 'edit_item' => __( 'Edit Book', 'gbt' ), 35 | 'update_item' => __( 'Update Book', 'gbt' ), 36 | 'view_item' => __( 'View Book', 'gbt' ), 37 | 'view_items' => __( 'View Books', 'gbt' ), 38 | 'search_items' => __( 'Search Books', 'gbt' ), 39 | 'not_found' => __( 'Not found', 'gbt' ), 40 | 'not_found_in_trash' => __( 'Not found in Trash', 'gbt' ), 41 | 'featured_image' => __( 'Featured Image', 'gbt' ), 42 | 'set_featured_image' => __( 'Set featured image', 'gbt' ), 43 | 'remove_featured_image' => __( 'Remove featured image', 'gbt' ), 44 | 'use_featured_image' => __( 'Use as featured image', 'gbt' ), 45 | 'insert_into_item' => __( 'Insert into item', 'gbt' ), 46 | 'uploaded_to_this_item' => __( 'Uploaded to this item', 'gbt' ), 47 | 'items_list' => __( 'Items list', 'gbt' ), 48 | 'items_list_navigation' => __( 'Items list navigation', 'gbt' ), 49 | 'filter_items_list' => __( 'Filter items list', 'gbt' ), 50 | ); 51 | $args = array( 52 | 'label' => __( 'Book', 'gbt' ), 53 | 'description' => __( 'Books', 'gbt' ), 54 | 'labels' => $labels, 55 | 'supports' => array( 'title', 'editor'), 56 | 'taxonomies' => array( 'genre', ' publisher' ), 57 | 'hierarchical' => false, 58 | 'public' => true, 59 | 'show_ui' => true, 60 | 'show_in_menu' => true, 61 | 'menu_position' => 5, 62 | 'menu_icon' => 'dashicons-book-alt', 63 | 'show_in_admin_bar' => true, 64 | 'show_in_nav_menus' => true, 65 | 'can_export' => true, 66 | 'has_archive' => true, 67 | 'exclude_from_search' => false, 68 | 'publicly_queryable' => true, 69 | 'capability_type' => 'post', 70 | 'show_in_rest' => true, 71 | ); 72 | register_post_type( 'gbtbooks', $args ); 73 | 74 | } 75 | add_action( 'init', 'register_books', 0 ); 76 | -------------------------------------------------------------------------------- /blueprints/fancy-dashboard_widget/blueprint.json: -------------------------------------------------------------------------------- 1 | { 2 | "$schema": "https://playground.wordpress.net/blueprint-schema.json", 3 | "meta": { 4 | "title": "Fancy Dashboard Widget", 5 | "description": "A blueprint to display statistics about users, posts and comments on a WordPress site.", 6 | "author": "muryamsultana" 7 | }, 8 | "login": true, 9 | "preferredVersions": { 10 | "php": "8.3", 11 | "wp": "latest" 12 | }, 13 | "features": { 14 | "networking": true 15 | }, 16 | "siteOptions": { 17 | "permalink_structure": "/%postname%/" 18 | }, 19 | "landingPage": "/wp-admin/?welcome=0", 20 | "steps": [ 21 | { 22 | "step": "updateUserMeta", 23 | "meta": { 24 | "admin_color": "modern" 25 | }, 26 | "userId": 1 27 | }, 28 | { 29 | "step": "installTheme", 30 | "themeData": { 31 | "resource": "wordpress.org/themes", 32 | "slug": "adventurer" 33 | } 34 | }, 35 | { 36 | "step": "activateTheme", 37 | "themeFolderName": "twentytwentyfive" 38 | }, 39 | { 40 | "step": "installPlugin", 41 | "pluginData": { 42 | "resource": "wordpress.org/plugins", 43 | "slug": "hello-dolly" 44 | } 45 | }, 46 | { 47 | "step": "mkdir", 48 | "path": "/wordpress/wp-content/plugins/my_custom_plugin" 49 | }, 50 | { 51 | "step": "writeFile", 52 | "path": "/wordpress/wp-content/plugins/my_custom_plugin/custom.php", 53 | "data": { 54 | "resource": "url", 55 | "url": "https://github.com/muryamsultana/playground/blob/main/custom.php" 56 | } 57 | }, 58 | { 59 | "step": "activatePlugin", 60 | "pluginPath": "my_custom_plugin/custom.php" 61 | } 62 | ] 63 | } 64 | -------------------------------------------------------------------------------- /blueprints/fancy-dashboard_widget/custom.php: -------------------------------------------------------------------------------- 1 | $default_dashboard['fancy_dashboard_widget'] ); 37 | unset( $default_dashboard['fancy_dashboard_widget'] ); 38 | 39 | // Merge the two arrays together so our widget is at the beginning. 40 | $sorted_dashboard = array_merge( $gt_dashboard_backup, $default_dashboard ); 41 | 42 | // Save the sorted array back into the original metaboxes. 43 | $wp_meta_boxes['dashboard']['normal']['core'] = $sorted_dashboard; 44 | } 45 | 46 | // Enqueue Tailwind CSS 47 | public function enqueue_styles($hook) { 48 | if ('index.php' !== $hook) { 49 | return; 50 | } 51 | wp_enqueue_style( 52 | 'fancy-dashboard-widget-css', 53 | 'https://cdn.jsdelivr.net/npm/tailwindcss@2.2.19/dist/tailwind.min.css', 54 | array(), 55 | '2.2.19' 56 | ); 57 | } 58 | 59 | // Render the widget content 60 | public function render_widget_content() { 61 | $recent_posts = wp_get_recent_posts(array('numberposts' => 5, 'post_status' => 'publish')); 62 | $user_count = count_users(); 63 | $current_user = wp_get_current_user(); 64 | ?> 65 |
66 |

Welcome, display_name); ?>!

67 | 68 | 69 |
70 |

Quick Stats

71 |
72 |
73 |

Total Posts

74 |

publish; ?>

75 |
76 |
77 |

Total Users

78 |

79 |
80 |
81 |

Comments

82 |

total_comments; ?>

83 |
84 |
85 |
86 | 87 | 88 |
89 |

Recent Posts

90 | 102 |
103 | 104 | 105 |
106 |

Quick Links

107 | 121 |
122 |
123 | 130 | -------------------------------------------------------------------------------- /blueprints/file-starter-content/blueprint.json: -------------------------------------------------------------------------------- 1 | { 2 | "$schema": "https://playground.wordpress.net/blueprint-schema.json", 3 | "meta": { 4 | "title": "Import a standalone starter content via a blueprint step", 5 | "author": "bph", 6 | "description": "Blueprint to use a stand-alone starter content file and then to import it. Click on 'Subscriptions'", 7 | "categories": ["Themes", "Starter Content"] 8 | }, 9 | "landingPage": "/", 10 | "steps": [ 11 | { 12 | "step": "writeFile", 13 | "path": "/wordpress/wp-content/plugins/starter-content.php", 14 | "data": { 15 | "resource": "url", 16 | "url": "https://raw.githubusercontent.com/wordpress/blueprints/trunk/blueprints/file-starter-content/startercontent.php" 17 | } 18 | }, 19 | { 20 | "step": "activatePlugin", 21 | "pluginPath": "/wordpress/wp-content/plugins/starter-content.php" 22 | }, 23 | { 24 | "step": "importThemeStarterContent" 25 | } 26 | ] 27 | } 28 | -------------------------------------------------------------------------------- /blueprints/file-starter-content/startercontent.php: -------------------------------------------------------------------------------- 1 | array( 14 | 'homepage-section' => array( 15 | 'post_type' => 'page', 16 | 'post_title' => _x( 'Our Subscriptions', 'Theme starter content', 'your-text-domain' ), 17 | 'post_content' => ' 18 |
19 | 20 | 21 |

We offer two subscription levels:

22 | 23 | 24 | 30 |
31 | ' 32 | ), 33 | ), 34 | ) ); 35 | } ); 36 | -------------------------------------------------------------------------------- /blueprints/friends-cors/blueprint.json: -------------------------------------------------------------------------------- 1 | { 2 | "$schema": "https://playground.wordpress.net/blueprint-schema.json", 3 | "meta": { 4 | "title": "Feed Reader with the Friends Plugin", 5 | "description": "By using the Friends plugin, you can read feeds from the web in Playground, and even via ActivityPub", 6 | "author": "akirk", 7 | "categories": ["rss", "social web"] 8 | }, 9 | "landingPage": "/friends/?refresh&welcome", 10 | "plugins": ["friends", "activitypub"], 11 | "siteOptions": { 12 | "permalink_structure": "/%postname%/" 13 | }, 14 | "steps": [ 15 | { 16 | "step": "runPHP", 17 | "code": "\n\nSubscriptions\n\n\n\n\n\n\n\n\");\n}" 18 | } 19 | ] 20 | } 21 | -------------------------------------------------------------------------------- /blueprints/gb-more-experiments/blueprint.json: -------------------------------------------------------------------------------- 1 | { 2 | "$schema": "https://playground.wordpress.net/blueprint-schema.json", 3 | "meta": { 4 | "title": "Enable all three Dataview Experiments in Gutenberg", 5 | "author": "bph", 6 | "description": "Blueprint example to enable multiple Experiments within the Gutenberg plugin ", 7 | "categories": ["Gutenberg", "Experiments"] 8 | }, 9 | "landingPage": "/wp-admin/site-editor.php", 10 | "plugins": ["gutenberg"], 11 | "login": true, 12 | "steps": [ 13 | { 14 | "step": "runPHP", 15 | "code": " true, 'gutenberg-new-posts-dashboard' => true, 'gutenberg-quick-edit-dataviews' => true ) );" 16 | }, 17 | { 18 | "step": "updateUserMeta", 19 | "meta": { 20 | "admin_color": "modern" 21 | }, 22 | "userId": 1 23 | } 24 | ] 25 | } 26 | -------------------------------------------------------------------------------- /blueprints/grid-variations/blueprint.json: -------------------------------------------------------------------------------- 1 | { 2 | "$schema": "https://playground.wordpress.net/blueprint-schema.json", 3 | "meta": { 4 | "title": "Grid Variations Experiments enabled", 5 | "author": "bph", 6 | "description": "Blueprint example to toggle on enable a feature from the Experiments page in Gutenberg plugin", 7 | "categories": ["Gutenberg", "Experiments"] 8 | }, 9 | "landingPage": "/wp-admin/site-editor.php", 10 | "login": true, 11 | "plugins": ["gutenberg"], 12 | "steps": [ 13 | { 14 | "step": "runPHP", 15 | "code": " true ) );" 16 | } 17 | ] 18 | } 19 | -------------------------------------------------------------------------------- /blueprints/install-activate-setup-theme-from-gh-repo/blueprint.json: -------------------------------------------------------------------------------- 1 | { 2 | "$schema": "https://playground.wordpress.net/blueprint-schema.json", 3 | "meta": { 4 | "title": "Loading, activating, and configuring a theme from a GitHub repository.", 5 | "description": "This is a good example of typical steps used on a theme's loading, activation and configuration", 6 | "author": "richtabor", 7 | "categories": ["theme"] 8 | }, 9 | "landingPage": "/wp-admin/site-editor.php", 10 | "login": true, 11 | "steps": [ 12 | { 13 | "step": "resetData" 14 | }, 15 | { 16 | "step": "writeFile", 17 | "path": "/wordpress/wp-content/mu-plugins/rewrite.php", 18 | "data": "set_permalink_structure('/%postname%/'); $wp_rewrite->flush_rules(); } );" 19 | }, 20 | { 21 | "step": "updateUserMeta", 22 | "meta": { 23 | "first_name": "Rich", 24 | "last_name": "Tabor", 25 | "admin_color": "modern" 26 | }, 27 | "userId": 1 28 | }, 29 | { 30 | "step": "installTheme", 31 | "themeData": { 32 | "resource": "url", 33 | "url": "https://github.com/richtabor/kanso/archive/refs/heads/main.zip" 34 | }, 35 | "options": { 36 | "activate": true 37 | } 38 | }, 39 | { 40 | "step": "importWxr", 41 | "file": { 42 | "resource": "url", 43 | "url": "https://github.com/WordPress/blueprints/blob/trunk/blueprints/install-activate-setup-theme-from-gh-repo/blueprint-content.xml" 44 | } 45 | } 46 | ], 47 | "siteOptions": { 48 | "blogname": "Rich Tabor", 49 | "blogdescription": "Multidisciplinary maker specializing in the intersection of product, design and engineering. Making WordPress.", 50 | "show_on_front": "page", 51 | "page_on_front": "6", 52 | "page_for_posts": "2" 53 | }, 54 | "plugins": ["todo-list-block", "markdown-comment-block"] 55 | } 56 | -------------------------------------------------------------------------------- /blueprints/install-activate-setup-theme-from-gh-repo/images/avatars.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/WordPress/blueprints/9552309fcca0d3fa8718ff7279601e48f7074631/blueprints/install-activate-setup-theme-from-gh-repo/images/avatars.png -------------------------------------------------------------------------------- /blueprints/install-plugin-from-gist/blueprint.json: -------------------------------------------------------------------------------- 1 | { 2 | "meta": { 3 | "title": "Install plugin from a gist", 4 | "author": "zieladam", 5 | "description": "Install and activate a WordPress plugin from a .php file stored in a gist.", 6 | "categories": ["plugins"] 7 | }, 8 | "landingPage": "/wp-admin/plugins.php", 9 | "preferredVersions": { 10 | "wp": "beta", 11 | "php": "8.3" 12 | }, 13 | "login": true, 14 | "steps": [ 15 | { 16 | "step": "writeFile", 17 | "path": "/wordpress/wp-content/plugins/0-plugin.php", 18 | "data": { 19 | "resource": "url", 20 | "url": "https://gist.githubusercontent.com/ndiego/456b74b243d86c97cda89264c68cbdee/raw/ff00cf25e6eebe4f5a4eaecff10286f71e65340b/block-hooks-demo.php" 21 | } 22 | }, 23 | { 24 | "step": "activatePlugin", 25 | "pluginName": "Block Hooks Demo", 26 | "pluginPath": "0-plugin.php" 27 | } 28 | ] 29 | } 30 | -------------------------------------------------------------------------------- /blueprints/latest-gutenberg/blueprint.json: -------------------------------------------------------------------------------- 1 | { 2 | "meta": { 3 | "title": "Latest Gutenberg plugin", 4 | "author": "zieladam", 5 | "description": "A preview of the latest version of the Gutenberg plugin.", 6 | "categories": ["plugins"] 7 | }, 8 | "plugins": ["gutenberg"] 9 | } 10 | -------------------------------------------------------------------------------- /blueprints/login-as-editor/blueprint.json: -------------------------------------------------------------------------------- 1 | { 2 | "$schema": "https://playground.wordpress.net/blueprint-schema.json", 3 | "meta": { 4 | "title": "Login as an editor", 5 | "description": "Test WordPress functionality as an editor rather than an administrator.", 6 | "author": "bacoords", 7 | "categories": ["User", "Role"] 8 | }, 9 | "landingPage": "/wp-admin/", 10 | "steps": [ 11 | { 12 | "step": "runPHP", 13 | "code": "set_role('editor');" 14 | }, 15 | { 16 | "step": "login", 17 | "username": "myuser", 18 | "password": "mypass" 19 | } 20 | ] 21 | } 22 | -------------------------------------------------------------------------------- /blueprints/posts-via-wp-cli/blueprint.json: -------------------------------------------------------------------------------- 1 | { 2 | "$schema": "https://playground.wordpress.net/blueprint-schema.json", 3 | "meta": { 4 | "title": "Use wp-cli command to add posts", 5 | "description": "Blueprint example to add posts via a wp-cli command.", 6 | "author": "bph", 7 | "categories": ["Content", "wpcli"] 8 | }, 9 | "landingPage": "/wp-admin/edit.php", 10 | "login": true, 11 | "steps": [ 12 | { 13 | "step": "wp-cli", 14 | "command": "wp post generate --count=12 --post_type=post --post_date=1999-01-04" 15 | } 16 | ] 17 | } 18 | -------------------------------------------------------------------------------- /blueprints/redirect-upload-requests/blueprint.json: -------------------------------------------------------------------------------- 1 | { 2 | "$schema": "https://playground.wordpress.net/blueprint-schema.json", 3 | "meta": { 4 | "title": "Serve media files from another host", 5 | "description": "Redirect any requests to files within the uploads directory to an external host. This is useful when you have a lot of image attachments in your playground but don\u2019t want to include them all in the blueprint.", 6 | "author": "ivanblagdan", 7 | "categories": ["Settings"] 8 | }, 9 | "landingPage": "/category/uncategorized/", 10 | "constants": { 11 | "PLAYGROUND_REDIRECT_UPLOADS_URL": "https://production.example.com" 12 | }, 13 | "steps": [ 14 | { 15 | "step": "writeFile", 16 | "path": "/wordpress/wp-content/mu-plugins/redirect-uploads.php", 17 | "data": " 'post', 'post_status' => 'publish', 'posts_per_page' => -1]; $posts = get_posts($args); error_log($message); if (!empty($posts)) { $last_post = $posts[count($posts) - 1]; error_log(count($posts) . ' posts - Last Post title: ' . $last_post->post_title); } else { error_log('No posts found'); } }" 16 | }, 17 | { 18 | "step": "runPHP", 19 | "code": " 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | 17 | 18 | 19 | 20 | 26 | 27 | 28 | My WordPress Website 29 | https://playground.wordpress.net/scope:0.1608808646050726 30 | 31 | Mon, 10 Jun 2024 12:29:10 +0000 32 | en-US 33 | 1.2 34 | https://playground.wordpress.net/scope:0.1608808646050726 35 | https://playground.wordpress.net/scope:0.1608808646050726 36 | 37 | 38 | 1 39 | 40 | 41 | 42 | 43 | 44 | 45 | 46 | 47 | https://wordpress.org/?v=6.5.4 48 | 49 | 50 | <![CDATA["The Road Not Taken" by Robert Frost]]> 51 | https://playground.wordpress.net/scope:0.1608808646050726/?p=1 52 | Wed, 05 Jun 2024 16:04:48 +0000 53 | 54 | http://127.0.0.1:9400/?p=1 55 | 56 | 57 |

Two roads diverged in a yellow wood,
And sorry I could not travel both
And be one traveler, long I stood
And looked down one as far as I could
To where it bent in the undergrowth;

58 | 59 | 60 | 61 |

Then took the other, as just as fair,
And having perhaps the better claim,
Because it was grassy and wanted wear;
Though as for that the passing there
Had worn them really about the same,

62 | 63 | 64 | 65 |

And both that morning equally lay
In leaves no step had trodden black.
Oh, I kept the first for another day!
Yet knowing how way leads on to way,
I doubted if I should ever come back.

66 | 67 | 68 | 69 |

I shall be telling this with a sigh
Somewhere ages and ages hence:
Two roads diverged in a wood, and I—
I took the one less traveled by,
And that has made all the difference.

70 | ]]>
71 | 72 | 10 73 | 74 | 75 | 76 | 77 | 78 | 79 | 80 | 81 | 0 82 | 0 83 | 84 | 85 | 0 86 | 87 | 88 | 89 | 90 | 91 | 92 | 93 | 94 | 95 |
96 |
97 |
98 | -------------------------------------------------------------------------------- /blueprints/set-admin-color-scheme/blueprint.json: -------------------------------------------------------------------------------- 1 | { 2 | "$schema": "https://playground.wordpress.net/blueprint-schema.json", 3 | "meta": { 4 | "title": "Set the admin color scheme", 5 | "description": "Set the admin color scheme to Modern using the updateUserMeta step.", 6 | "author": "ndiego", 7 | "categories": ["user meta"] 8 | }, 9 | "preferredVersions": { 10 | "php": "8.3", 11 | "wp": "latest" 12 | }, 13 | "landingPage": "/wp-admin/?welcome=0", 14 | "login": true, 15 | "steps": [ 16 | { 17 | "step": "updateUserMeta", 18 | "meta": { 19 | "admin_color": "modern" 20 | }, 21 | "userId": 1 22 | } 23 | ] 24 | } 25 | -------------------------------------------------------------------------------- /blueprints/showcase-plugin-with-media/assets/2024.zip: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/WordPress/blueprints/9552309fcca0d3fa8718ff7279601e48f7074631/blueprints/showcase-plugin-with-media/assets/2024.zip -------------------------------------------------------------------------------- /blueprints/showcase-plugin-with-media/assets/twentytwentyfour-child.zip: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/WordPress/blueprints/9552309fcca0d3fa8718ff7279601e48f7074631/blueprints/showcase-plugin-with-media/assets/twentytwentyfour-child.zip -------------------------------------------------------------------------------- /blueprints/showcase-plugin-with-media/blueprint.json: -------------------------------------------------------------------------------- 1 | { 2 | "$schema": "https://playground.wordpress.net/blueprint-schema.json", 3 | "meta": { 4 | "title": "Showcase plugin", 5 | "description": "Showcase custom plugin from own server with media files and content imported as WXR. There is a readme file in github repository (https://github.com/Lovor01/blueprints/blob/trunk/blueprints/showcase-plugin-with-media/readme.md) which explains all steps.", 6 | "author": "Lovor01", 7 | "categories": ["plugin", "demo", "media", "images"] 8 | }, 9 | "preferredVersions": { 10 | "php": "8.3", 11 | "wp": "6.7" 12 | }, 13 | "landingPage": "/", 14 | "steps": [ 15 | { 16 | "step": "login", 17 | "username": "admin" 18 | }, 19 | { 20 | "step": "installPlugin", 21 | "pluginData": { 22 | "resource": "wordpress.org/plugins", 23 | "slug": "makeiteasy-back-to-top" 24 | }, 25 | "options": { 26 | "activate": true 27 | } 28 | }, 29 | { 30 | "step": "installPlugin", 31 | "pluginData": { 32 | "resource": "wordpress.org/plugins", 33 | "slug": "makeiteasy-popup" 34 | }, 35 | "options": { 36 | "activate": true 37 | } 38 | }, 39 | { 40 | "step": "installTheme", 41 | "themeData": { 42 | "resource": "wordpress.org/themes", 43 | "slug": "twentytwentyfour" 44 | } 45 | }, 46 | { 47 | "step": "installTheme", 48 | "themeData": { 49 | "resource": "url", 50 | "url": "https://raw.githubusercontent.com/Lovor01/blueprints/trunk/blueprints/showcase-plugin-with-media/assets/twentytwentyfour-child.zip" 51 | }, 52 | "options": { 53 | "activate": true 54 | } 55 | }, 56 | { 57 | "step": "setSiteOptions", 58 | "options": { 59 | "blogname": "MakeITeasy popup demo", 60 | "blogdescription": "Popup demo", 61 | "page_on_front": "4", 62 | "users_can_register": "0", 63 | "posts_per_page": "10", 64 | "default_role": "subscriber", 65 | "uploads_use_yearmonth_folders": "1", 66 | "blog_public": "1", 67 | "show_on_front": "page" 68 | } 69 | }, 70 | { 71 | "step": "setSiteOptions", 72 | "options": { 73 | "thumbnail_size_w": "150", 74 | "thumbnail_size_h": "150", 75 | "thumbnail_crop": "1", 76 | "medium_size_w": "300", 77 | "medium_size_h": "300", 78 | "avatar_default": "mystery", 79 | "large_size_w": "1024", 80 | "large_size_h": "1024" 81 | } 82 | }, 83 | { 84 | "step": "unzip", 85 | "zipFile": { 86 | "resource": "url", 87 | "url": "https://raw.githubusercontent.com/Lovor01/blueprints/trunk/blueprints/showcase-plugin-with-media/assets/2024.zip" 88 | }, 89 | "extractToPath": "/wordpress/wp-content/uploads" 90 | }, 91 | { 92 | "step": "importWxr", 93 | "file": { 94 | "resource": "url", 95 | "url": "https://raw.githubusercontent.com/Lovor01/blueprints/trunk/blueprints/showcase-plugin-with-media/assets/makeiteasypopupblock.WordPress.2024-06-20.xml" 96 | } 97 | } 98 | ] 99 | } 100 | -------------------------------------------------------------------------------- /blueprints/showcase-plugin-with-media/readme.md: -------------------------------------------------------------------------------- 1 | # Showcase custom plugin from own server with media files and custom theme 2 | 3 | ➡ Custom theme is customized child theme of twentytwentyfour 4 | 5 | ### Installing theme 6 | 7 | Custom child theme is zipped and installed as [URLReference](https://wordpress.github.io/wordpress-playground/blueprints/steps/resources#urlreference) with 8 | [InstallTheme](https://wordpress.github.io/wordpress-playground/blueprints/steps#InstallThemeStep) step. 9 | 10 | ### Installing plugin 11 | 12 | Plugin is installed from _WordPress.org_ repository. If your plugin is not (yet) there, you could self-host it and install it as [URLReference](https://wordpress.github.io/wordpress-playground/blueprints/steps/resources#urlreference) resource. 13 | 14 | ### Importing media files into file system 15 | 16 | Here, the [unzip](https://wordpress.github.io/wordpress-playground/blueprints/steps#UnzipStep) step is used: 17 | zip all the folders in upload folder and in unzip step unpack them to respective path `/site-slug/wp-content/uploads`, where slug 18 | is the custom slug if given, e.g. for `site-slug=mysite` in URL query, path would be `/site-mysite/wp-content/uploads`. If custom slug is not given, replace site-slug 19 | with `wordpress`. In this example, all media content from 2024 year is packed as 2024 folder in _.zip_ file, just as it appears in WordPress content directory. 20 | 21 | ### Setting defaults 22 | 23 | `setSiteOptions` step is used to set home page and other default WP options, and `landingPage` json property is used to start on front page instead of admin. 24 | In your example, you would replace `page_on_front` option with page ID which is front page (if you have front page and not blog list as homepage). 25 | 26 | ### Transfering content 27 | 28 | > For transferring content, WXR file is used. The same could be probably achieved with sql dump and runsql step. 29 | 30 | After exporting WXR from standard WordPress installation, URL-s in file have to be adjusted. For example, do search-replace to replace 31 | `https://myserver.com/` into `/`, which is the url root in playground. 32 | 33 | If sql export-import is used, I propose similarly to use wp-cli search-replace command with export option to do same url string replacement. 34 | -------------------------------------------------------------------------------- /blueprints/stylish-press/blueprint.json: -------------------------------------------------------------------------------- 1 | { 2 | "$schema": "https://playground.wordpress.net/blueprint-schema.json", 3 | "meta": { 4 | "title": "Stylish Press", 5 | "description": "A Woo store with custom theme, content, and products.", 6 | "author": "adamziel", 7 | "categories": ["Woocommerce", "Site"] 8 | }, 9 | "landingPage": "/contact-us/", 10 | "preferredVersions": { 11 | "php": "8.3", 12 | "wp": "latest" 13 | }, 14 | "features": { 15 | "intl": true 16 | }, 17 | "login": true, 18 | "plugins": ["woocommerce"], 19 | "steps": [ 20 | { 21 | "step": "resetData" 22 | }, 23 | { 24 | "step": "writeFile", 25 | "path": "/wordpress/wp-content/mu-plugins/rewrite.php", 26 | "data": "set_permalink_structure('/%postname%/'); $wp_rewrite->flush_rules(); } );" 27 | }, 28 | { 29 | "step": "importWxr", 30 | "file": { 31 | "resource": "url", 32 | "url": "https://raw.githubusercontent.com/wordpress/blueprints/trunk/blueprints/stylish-press/woo-products.wxr" 33 | } 34 | }, 35 | { 36 | "step": "importWxr", 37 | "file": { 38 | "resource": "url", 39 | "url": "https://raw.githubusercontent.com/wordpress/blueprints/trunk/blueprints/stylish-press/site-content.wxr" 40 | } 41 | }, 42 | { 43 | "step": "mkdir", 44 | "path": "/wordpress/wp-content/themes/stylish-press-theme" 45 | }, 46 | { 47 | "step": "writeFile", 48 | "path": "/wordpress/wp-content/themes/stylish-press-theme/style.css", 49 | "data": { 50 | "resource": "url", 51 | "url": "https://raw.githubusercontent.com/WordPress/blueprints/stylish-press/blueprints/stylish-press/stylish-press-theme/style.css" 52 | } 53 | }, 54 | { 55 | "step": "writeFile", 56 | "path": "/wordpress/wp-content/themes/stylish-press-theme/theme.json", 57 | "data": { 58 | "resource": "url", 59 | "url": "https://raw.githubusercontent.com/wordpress/blueprints/trunk/blueprints/stylish-press/stylish-press-theme/theme.json" 60 | } 61 | }, 62 | { 63 | "step": "writeFile", 64 | "path": "/wordpress/wp-content/themes/stylish-press-theme/functions.php", 65 | "data": { 66 | "resource": "url", 67 | "url": "https://raw.githubusercontent.com/wordpress/blueprints/trunk/blueprints/stylish-press/stylish-press-theme/functions.php" 68 | } 69 | }, 70 | { 71 | "step": "mkdir", 72 | "path": "/wordpress/wp-content/themes/stylish-press-theme/parts" 73 | }, 74 | { 75 | "step": "writeFile", 76 | "path": "/wordpress/wp-content/themes/stylish-press-theme/parts/header.html", 77 | "data": { 78 | "resource": "url", 79 | "url": "https://raw.githubusercontent.com/wordpress/blueprints/trunk/blueprints/stylish-press/stylish-press-theme/parts/header.html" 80 | } 81 | }, 82 | { 83 | "step": "installTheme", 84 | "themeData": { 85 | "resource": "wordpress.org/themes", 86 | "slug": "twentytwentyfour" 87 | } 88 | }, 89 | { 90 | "step": "activateTheme", 91 | "themeFolderName": "stylish-press-theme" 92 | }, 93 | { 94 | "step": "setSiteOptions", 95 | "options": { 96 | "blogname": "Stylish Press", 97 | "woocommerce_store_city": "Wroc\u0142aw", 98 | "woocommerce_store_address": "Aleje Jerozolimskie 14", 99 | "woocommerce_store_postcode": "00-153", 100 | "woocommerce_default_country": "Poland", 101 | "woocommerce_onboarding_profile": { 102 | "skipped": true 103 | }, 104 | "woocommerce_currency": "PLN", 105 | "woocommerce_weight_unit": "oz", 106 | "woocommerce_dimension_unit": "in", 107 | "woocommerce_allow_tracking": "no", 108 | "woocommerce_cheque_settings": { 109 | "enabled": "yes" 110 | } 111 | } 112 | } 113 | ] 114 | } 115 | -------------------------------------------------------------------------------- /blueprints/stylish-press/site-content.wxr: -------------------------------------------------------------------------------- 1 | 2 | 9 | 10 | Stylish Press 11 | http://www.stylishpress.wordpress.org 12 | Fashion-forward apparel for everyone! 13 | Tue, 05 Jun 2024 12:00:00 +0000 14 | en-US 15 | 1.2 16 | http://www.stylishpress.wordpress.org 17 | http://www.stylishpress.wordpress.org 18 | 19 | 20 | 1 21 | admin 22 | admin@stylishpress.wordpress.org 23 | 24 | 25 | 26 | 27 | 28 | 29 | 30 | Homepage 31 | http://www.stylishpress.wordpress.org/home 32 | Tue, 05 Jun 2024 12:00:00 +0000 33 | 34 | 35 | http://www.stylishpress.wordpress.org/?p=1 36 | 37 | 39 |
40 | 41 |
42 | 43 |

Welcome to Stylish Press

44 | 45 | 46 |

Discover the latest in fashion and style.

47 | 48 |
49 |
50 | 51 | 52 | 53 |
54 | 55 |
56 | 57 |
Trendy Outfit
58 | 59 |
60 | 61 | 62 |
63 | 64 |

At Stylish Press, we're dedicated to bringing you the latest trends in fashion. Our collection is carefully curated to ensure you look your best, whether you're hitting the streets or the runway. Explore our site to find out more about our latest collections, fashion tips, and exclusive offers.

65 | 66 | 67 |

Browse through our diverse range of apparel, featuring everything from chic tops to stylish bottoms, and accessories that complete your look. Our pieces are designed to make you feel confident and fashionable, day or night.

68 | 69 |
70 | 71 |
72 | 73 | 74 | 75 | 76 | 77 | 78 | 79 |

Our Mission

80 | 81 | 82 |

Stylish Press was founded with a firm belief that fashion should be accessible, inclusive, and always evolving. We aim to empower our customers to express themselves through bold and contemporary designs that speak volumes about their unique style.

83 | 84 | ]]>
85 | 86 | 1 87 | 2024-06-05 12:00:00 88 | 2024-06-05 12:00:00 89 | closed 90 | closed 91 | home 92 | publish 93 | page 94 | 0 95 | 1 96 | 97 | _edit_last 98 | 1 99 | 100 |
101 | 102 | 103 | 104 | The Stylish Story 105 | http://www.stylishpress.wordpress.org/the-stylish-story 106 | Tue, 05 Jun 2024 12:00:00 +0000 107 | 108 | 109 | http://www.stylishpress.wordpress.org/?p=2 110 | 111 | 113 |
114 | 115 |
116 | 117 |

The Stylish Story

118 | 119 |
120 |
121 | 122 | 123 | 124 |

Our Beginnings

125 | 126 | 127 |

Stylish Press was founded in 2020 by a group of fashion enthusiasts who wanted to bring a fresh perspective to the fashion industry. We began as a small online store, focusing on minimalist designs with a bold twist. Our unique approach quickly gained a loyal following, and we have been expanding our collection ever since.

128 | 129 | 130 | 131 | 150 | 151 | 152 | 153 | 154 | 155 | 156 | 157 |

Our Commitment

158 | 159 | 160 |

We believe in sustainable fashion practices and ethical sourcing. Every piece in our collection is made with care, ensuring minimal impact on the environment. Our commitment to quality craftsmanship means that each item is built to last, keeping you stylish and sustainable.

161 | 162 | 163 | 164 |
165 |

"Fashion is not just about looking good, it's about feeling good and doing good." - Founders of Stylish Press

166 |
167 | 168 | 169 | 170 |

Join us on our journey to revolutionize the fashion industry, one stylish piece at a time. Together, we can make fashion more inclusive, innovative, and inspiring.

171 | 172 | ]]>
173 | 174 | 2 175 | 2024-06-05 12:00:00 176 | 2024-06-05 12:00:00 177 | closed 178 | closed 179 | the-stylish-story 180 | publish 181 | page 182 | 0 183 | 2 184 | 185 | _edit_last 186 | 1 187 | 188 |
189 | 190 | 191 | 192 | Connect 193 | http://www.stylishpress.wordpress.org/contact-us 194 | Tue, 05 Jun 2024 12:00:00 +0000 195 | 196 | 197 | http://www.stylishpress.wordpress.org/?p=5 198 | 199 | 201 |
202 | 203 |
204 | 205 |

Connect with Us

206 | 207 |
208 |
209 | 210 | 211 | 212 |

We love hearing from our customers! Whether you have questions about our products, need styling advice, or just want to share your own fashion journey, we're here for you. Reach out to us through our various contact points listed below, and let’s stay connected.

213 | 214 | 215 | 216 |
217 | 218 |
219 | 220 |
221 | 222 | 223 |
224 | 225 |

Find Us Here

226 | 227 | 228 |

Email: support@stylishpress.wordpress.org

229 | 230 | 231 |

Phone: +1 (234) 567-890

232 | 233 | 234 |

Address: 123 Fashion Street, Trend City, ST 56789

235 | 236 | 237 |

Follow Us

238 | 239 | 240 | 245 | 246 |
247 | 248 |
249 | 250 | 251 | 252 |
253 |

"Fashion is instant language." - Miuccia Prada

254 |
255 | 256 | 257 | 258 |

Connect with Stylish Press today and become a part of our vibrant community where fashion meets passion.

259 | 260 | ]]>
261 | 262 | 5 263 | 2024-06-05 12:00:00 264 | 2024-06-05 12:00:00 265 | closed 266 | closed 267 | contact-us 268 | publish 269 | page 270 | 0 271 | 5 272 | 273 | _edit_last 274 | 1 275 | 276 |
277 | 278 |
279 |
-------------------------------------------------------------------------------- /blueprints/stylish-press/stylish-press-theme/functions.php: -------------------------------------------------------------------------------- 1 | 3 |
5 | 6 |
7 | 8 | 9 | 10 |
11 | 12 | 13 | 14 |
15 | 16 |
17 | 18 |
19 | 20 |
21 | 22 |
23 | 24 | -------------------------------------------------------------------------------- /blueprints/stylish-press/stylish-press-theme/style.css: -------------------------------------------------------------------------------- 1 | /** 2 | * Theme Name: Stylish Press Child Theme 3 | * Theme URI: http://example.com/stylish-press-child 4 | * Description: Child theme for Twenty Twenty-Four. 5 | * Author: Your Name 6 | * Author URI: http://example.com 7 | * Template: twentytwentyfour 8 | * Version: 1.0.0 9 | */ -------------------------------------------------------------------------------- /blueprints/stylish-press/stylish-press-theme/theme.json: -------------------------------------------------------------------------------- 1 | { 2 | "$schema": "https://schemas.wp.org/trunk/theme.json", 3 | "version": 2, 4 | "settings": { 5 | "color": { 6 | "palette": [ 7 | { "slug": "st-primary", "color": "#1E1E1E", "name": "Primary" }, 8 | { 9 | "slug": "st-secondary", 10 | "color": "#FF6E40", 11 | "name": "Secondary" 12 | }, 13 | { 14 | "slug": "background", 15 | "color": "#121212", 16 | "name": "Background" 17 | }, 18 | { "slug": "text", "color": "#E0E0E0", "name": "Text" }, 19 | { 20 | "slug": "heading-text", 21 | "color": "#FFFFFF", 22 | "name": "Heading Text" 23 | }, 24 | { "slug": "link", "color": "#FF6E40", "name": "Link" } 25 | ], 26 | "background": "#121212", 27 | "text": "#E0E0E0", 28 | "link": "#FF6E40" 29 | }, 30 | "fontFamilies": [ 31 | { 32 | "fontFamily": "'Montserrat', sans-serif", 33 | "slug": "montserrat", 34 | "name": "Montserrat" 35 | }, 36 | { 37 | "fontFamily": "'Open Sans', sans-serif", 38 | "slug": "open-sans", 39 | "name": "Open Sans" 40 | } 41 | ], 42 | "custom": { "components": { "buttons": { "borderRadius": "4px" } } } 43 | }, 44 | "styles": { 45 | "color": { 46 | "background": "#121212", 47 | "text": "#E0E0E0", 48 | "link": "#FF6E40" 49 | }, 50 | "typography": { "fontFamily": "Open Sans, sans-serif" }, 51 | "elements": { 52 | "h1": { 53 | "typography": { 54 | "fontFamily": "Montserrat, sans-serif", 55 | "fontWeight": "700", 56 | "color": "#FFFFFF" 57 | } 58 | }, 59 | "h2": { 60 | "typography": { 61 | "fontFamily": "Montserrat, sans-serif", 62 | "fontWeight": "700", 63 | "color": "#FFFFFF" 64 | } 65 | }, 66 | "h3": { 67 | "typography": { 68 | "fontFamily": "Montserrat, sans-serif", 69 | "fontWeight": "700", 70 | "color": "#FFFFFF" 71 | } 72 | }, 73 | "button": { 74 | "color": { "background": "#FF6E40", "text": "#FFFFFF" }, 75 | "border": { "radius": "4px" } 76 | } 77 | }, 78 | "blocks": { 79 | "core/paragraph": { 80 | "typography": { 81 | "fontFamily": "Open Sans, sans-serif", 82 | "fontSize": "16px" 83 | } 84 | }, 85 | "core/heading": { 86 | "typography": { "fontFamily": "Montserrat, sans-serif" } 87 | }, 88 | "core/button": { 89 | "color": { "background": "#FF6E40", "text": "#FFFFFF" }, 90 | "border": { "radius": "4px" } 91 | } 92 | } 93 | } 94 | } 95 | -------------------------------------------------------------------------------- /blueprints/stylish-press/woo-product-images/album-1.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/WordPress/blueprints/9552309fcca0d3fa8718ff7279601e48f7074631/blueprints/stylish-press/woo-product-images/album-1.jpg -------------------------------------------------------------------------------- /blueprints/stylish-press/woo-product-images/beanie-2.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/WordPress/blueprints/9552309fcca0d3fa8718ff7279601e48f7074631/blueprints/stylish-press/woo-product-images/beanie-2.jpg -------------------------------------------------------------------------------- /blueprints/stylish-press/woo-product-images/beanie-with-logo-1.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/WordPress/blueprints/9552309fcca0d3fa8718ff7279601e48f7074631/blueprints/stylish-press/woo-product-images/beanie-with-logo-1.jpg -------------------------------------------------------------------------------- /blueprints/stylish-press/woo-product-images/belt-2.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/WordPress/blueprints/9552309fcca0d3fa8718ff7279601e48f7074631/blueprints/stylish-press/woo-product-images/belt-2.jpg -------------------------------------------------------------------------------- /blueprints/stylish-press/woo-product-images/cap-2.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/WordPress/blueprints/9552309fcca0d3fa8718ff7279601e48f7074631/blueprints/stylish-press/woo-product-images/cap-2.jpg -------------------------------------------------------------------------------- /blueprints/stylish-press/woo-product-images/hoodie-2.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/WordPress/blueprints/9552309fcca0d3fa8718ff7279601e48f7074631/blueprints/stylish-press/woo-product-images/hoodie-2.jpg -------------------------------------------------------------------------------- /blueprints/stylish-press/woo-product-images/hoodie-blue-1.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/WordPress/blueprints/9552309fcca0d3fa8718ff7279601e48f7074631/blueprints/stylish-press/woo-product-images/hoodie-blue-1.jpg -------------------------------------------------------------------------------- /blueprints/stylish-press/woo-product-images/hoodie-green-1.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/WordPress/blueprints/9552309fcca0d3fa8718ff7279601e48f7074631/blueprints/stylish-press/woo-product-images/hoodie-green-1.jpg -------------------------------------------------------------------------------- /blueprints/stylish-press/woo-product-images/hoodie-with-logo-2.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/WordPress/blueprints/9552309fcca0d3fa8718ff7279601e48f7074631/blueprints/stylish-press/woo-product-images/hoodie-with-logo-2.jpg -------------------------------------------------------------------------------- /blueprints/stylish-press/woo-product-images/hoodie-with-pocket-2.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/WordPress/blueprints/9552309fcca0d3fa8718ff7279601e48f7074631/blueprints/stylish-press/woo-product-images/hoodie-with-pocket-2.jpg -------------------------------------------------------------------------------- /blueprints/stylish-press/woo-product-images/hoodie-with-zipper-2.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/WordPress/blueprints/9552309fcca0d3fa8718ff7279601e48f7074631/blueprints/stylish-press/woo-product-images/hoodie-with-zipper-2.jpg -------------------------------------------------------------------------------- /blueprints/stylish-press/woo-product-images/logo-1.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/WordPress/blueprints/9552309fcca0d3fa8718ff7279601e48f7074631/blueprints/stylish-press/woo-product-images/logo-1.jpg -------------------------------------------------------------------------------- /blueprints/stylish-press/woo-product-images/long-sleeve-tee-2.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/WordPress/blueprints/9552309fcca0d3fa8718ff7279601e48f7074631/blueprints/stylish-press/woo-product-images/long-sleeve-tee-2.jpg -------------------------------------------------------------------------------- /blueprints/stylish-press/woo-product-images/pennant-1.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/WordPress/blueprints/9552309fcca0d3fa8718ff7279601e48f7074631/blueprints/stylish-press/woo-product-images/pennant-1.jpg -------------------------------------------------------------------------------- /blueprints/stylish-press/woo-product-images/polo-2.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/WordPress/blueprints/9552309fcca0d3fa8718ff7279601e48f7074631/blueprints/stylish-press/woo-product-images/polo-2.jpg -------------------------------------------------------------------------------- /blueprints/stylish-press/woo-product-images/single-1.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/WordPress/blueprints/9552309fcca0d3fa8718ff7279601e48f7074631/blueprints/stylish-press/woo-product-images/single-1.jpg -------------------------------------------------------------------------------- /blueprints/stylish-press/woo-product-images/sunglasses-2.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/WordPress/blueprints/9552309fcca0d3fa8718ff7279601e48f7074631/blueprints/stylish-press/woo-product-images/sunglasses-2.jpg -------------------------------------------------------------------------------- /blueprints/stylish-press/woo-product-images/t-shirt-with-logo-1.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/WordPress/blueprints/9552309fcca0d3fa8718ff7279601e48f7074631/blueprints/stylish-press/woo-product-images/t-shirt-with-logo-1.jpg -------------------------------------------------------------------------------- /blueprints/stylish-press/woo-product-images/tshirt-2.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/WordPress/blueprints/9552309fcca0d3fa8718ff7279601e48f7074631/blueprints/stylish-press/woo-product-images/tshirt-2.jpg -------------------------------------------------------------------------------- /blueprints/stylish-press/woo-product-images/vnech-tee-blue-1.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/WordPress/blueprints/9552309fcca0d3fa8718ff7279601e48f7074631/blueprints/stylish-press/woo-product-images/vnech-tee-blue-1.jpg -------------------------------------------------------------------------------- /blueprints/stylish-press/woo-product-images/vnech-tee-green-1.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/WordPress/blueprints/9552309fcca0d3fa8718ff7279601e48f7074631/blueprints/stylish-press/woo-product-images/vnech-tee-green-1.jpg -------------------------------------------------------------------------------- /blueprints/stylish-press/woo-product-images/vneck-tee-2.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/WordPress/blueprints/9552309fcca0d3fa8718ff7279601e48f7074631/blueprints/stylish-press/woo-product-images/vneck-tee-2.jpg -------------------------------------------------------------------------------- /blueprints/theme-a11y-test/blueprint.json: -------------------------------------------------------------------------------- 1 | { 2 | "$schema": "https://playground.wordpress.net/blueprint-schema.json", 3 | "meta": { 4 | "title": "Theme Tester", 5 | "description": "Blueprint example to add content and plugins to explore a theme", 6 | "author": "bph", 7 | "categories": ["themes", "content"] 8 | }, 9 | "preferredVersions": { 10 | "php": "8.3", 11 | "wp": "beta" 12 | }, 13 | "login": true, 14 | "plugins": ["create-block-theme"], 15 | "steps": [ 16 | { 17 | "step": "importWxr", 18 | "file": { 19 | "resource": "url", 20 | "url": "https://github.com/wpaccessibility/a11y-theme-unit-test/blob/master/a11y-theme-unit-test-data.xml" 21 | } 22 | }, 23 | { 24 | "step": "importWxr", 25 | "file": { 26 | "resource": "url", 27 | "url": "https://github.com/WordPress/theme-test-data/blob/master/themeunittestdata.wordpress.xml" 28 | } 29 | }, 30 | { 31 | "step": "installTheme", 32 | "themeData": { 33 | "resource": "wordpress.org/themes", 34 | "slug": "twentytwentyfive" 35 | }, 36 | "options": { 37 | "activate": true 38 | } 39 | } 40 | ] 41 | } 42 | -------------------------------------------------------------------------------- /blueprints/theme-starter-content/blueprint.json: -------------------------------------------------------------------------------- 1 | { 2 | "$schema": "https://playground.wordpress.net/blueprint-schema.json", 3 | "meta": { 4 | "title": "Import Theme Starter Content", 5 | "author": "bph", 6 | "description": "Blueprint to install a theme with starter content, (here: Twenty-Twenty-One)", 7 | "categories": ["Themes", "Starter Content"] 8 | }, 9 | "landingPage": "/", 10 | "steps": [ 11 | { 12 | "step": "installTheme", 13 | "themeData": { 14 | "resource": "wordpress.org/themes", 15 | "slug": "twentytwentyone" 16 | }, 17 | "options": { 18 | "activate": true, 19 | "importStarterContent": true 20 | } 21 | } 22 | ] 23 | } 24 | -------------------------------------------------------------------------------- /blueprints/translations/blueprint.json: -------------------------------------------------------------------------------- 1 | { 2 | "meta": { 3 | "title": "Install WordPress language packs", 4 | "author": "adamziel", 5 | "description": "Installs and activates the latest WordPress Japanese translation pack from https://translate.wordpress.org/ \u2013 both for WordPress core and for the friends plugin.", 6 | "categories": ["core"] 7 | }, 8 | "landingPage": "/wp-admin/?welcome=0", 9 | "login": true, 10 | "plugins": ["friends"], 11 | "steps": [ 12 | { 13 | "step": "setSiteLanguage", 14 | "language": "ja" 15 | } 16 | ] 17 | } 18 | -------------------------------------------------------------------------------- /blueprints/tt5-demo/blueprint.json: -------------------------------------------------------------------------------- 1 | { 2 | "$schema": "https://playground.wordpress.net/blueprint-schema.json", 3 | "meta": { 4 | "title": "Demo of Twenty-Twenty-Five theme", 5 | "description": "Blueprint with demo content for the Twenty-Twenty-Five default theme", 6 | "author": "bph", 7 | "categories": ["Themes", "default"] 8 | }, 9 | "landingPage": "/", 10 | "login": true, 11 | "preferredVersions": { 12 | "php": "8.3", 13 | "wp": "beta" 14 | }, 15 | "steps": [ 16 | { 17 | "step": "resetData" 18 | }, 19 | { 20 | "step": "updateUserMeta", 21 | "meta": { 22 | "admin_color": "modern" 23 | }, 24 | "userId": 1 25 | }, 26 | { 27 | "step": "writeFile", 28 | "path": "/wordpress/wp-content/mu-plugins/rewrite.php", 29 | "data": "set_permalink_structure('/%postname%/'); $wp_rewrite->flush_rules(); } );" 30 | }, 31 | { 32 | "step": "importWxr", 33 | "file": { 34 | "resource": "url", 35 | "url": "https://raw.githubusercontent.com/wordpress/blueprints/trunk/blueprints/tt5-demo/tt5-demo-content.xml" 36 | } 37 | }, 38 | { 39 | "step": "setSiteOptions", 40 | "options": { 41 | "blogname": "Twenty-Twenty-Five", 42 | "blogdescription": "A preview of the next WordPress default theme" 43 | } 44 | } 45 | ] 46 | } 47 | -------------------------------------------------------------------------------- /blueprints/use-pretty-permalinks/blueprint.json: -------------------------------------------------------------------------------- 1 | { 2 | "$schema": "https://playground.wordpress.net/blueprint-schema.json", 3 | "meta": { 4 | "title": "Pretty permalinks", 5 | "description": "Set the permalink structure to use pretty permalinks.", 6 | "author": "bgrgicak", 7 | "categories": ["Settings"] 8 | }, 9 | "landingPage": "/category/uncategorized/", 10 | "login": true, 11 | "steps": [ 12 | { 13 | "step": "writeFile", 14 | "path": "/wordpress/wp-content/mu-plugins/rewrite.php", 15 | "data": "set_permalink_structure('/%postname%/'); $wp_rewrite->flush_rules(); } );" 16 | } 17 | ] 18 | } 19 | -------------------------------------------------------------------------------- /blueprints/user-meta/blueprint.json: -------------------------------------------------------------------------------- 1 | { 2 | "$schema": "https://playground.wordpress.net/blueprint-schema.json", 3 | "meta": { 4 | "title": "Creating a new user for the blog", 5 | "description": "This is a simple example to update user meta data", 6 | "author": "fellyph", 7 | "categories": ["meta"] 8 | }, 9 | "landingPage": "/wp-admin/users.php", 10 | "login": true, 11 | "steps": [ 12 | { 13 | "step": "resetData" 14 | }, 15 | { 16 | "step": "updateUserMeta", 17 | "meta": { 18 | "first_name": "John", 19 | "last_name": "Doe", 20 | "admin_color": "midnight", 21 | "nickname": "Johny", 22 | "description": "This is the biographical info from John Doe." 23 | }, 24 | "userId": 1 25 | } 26 | ], 27 | "siteOptions": { 28 | "blogname": "John Boe Blog", 29 | "blogdescription": "Everything about Blueprints" 30 | } 31 | } 32 | -------------------------------------------------------------------------------- /blueprints/welcome/README.md: -------------------------------------------------------------------------------- 1 | ## WordPress Playground default "Welcome" Blueprint 2 | 3 | This folder contains the default Blueprint applied when visiting playground.wordpress.net with no parameters: 4 | 5 | CleanShot 2025-10-07 at 18 27 09@2x 6 | 7 | 8 | This Blueprint helps newcomers understand what Playground is without altering how WordPress is normally set up. The only change it applies is inserting one extra page with onboarding instructions. There are no custom menus, global styles, mu-plugins, etc. 9 | 10 | When the default instance looks and behaves like WordPress core, it remains a reliable baseline for everyone. New users get useful instructions, and experienced Playground developers get the vanilla WordPress experience they need. 11 | 12 | ### Working with the welcome Blueprint 13 | 14 | Updating the content is cumbersome since we intentionally avoid the typical tools such as a WXR import plugin, custom themes, The content of the sole page this Blueprint inserts is shipped as a JSON-encoded string inside the blueprint.json. Here's how you can update it: 15 | 16 | 1. Run the Blueprint inside Playground. 17 | 2. Edit the welcome page in WordPress (e.g., update text or layout). 18 | 3. Switch to the code editor and copy the HTML. 19 | 4. Convert that code into a JSON string. 20 | 5. Replace the existing content in the Blueprint file. 21 | 22 | -------------------------------------------------------------------------------- /blueprints/welcome/assets/fonts/ebgaramond-regular.ttf: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/WordPress/blueprints/9552309fcca0d3fa8718ff7279601e48f7074631/blueprints/welcome/assets/fonts/ebgaramond-regular.ttf -------------------------------------------------------------------------------- /blueprints/welcome/assets/fonts/inter-regular.ttf: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/WordPress/blueprints/9552309fcca0d3fa8718ff7279601e48f7074631/blueprints/welcome/assets/fonts/inter-regular.ttf -------------------------------------------------------------------------------- /blueprints/welcome/assets/imgs/cover-image-playground-2.webp: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/WordPress/blueprints/9552309fcca0d3fa8718ff7279601e48f7074631/blueprints/welcome/assets/imgs/cover-image-playground-2.webp -------------------------------------------------------------------------------- /blueprints/welcome/assets/imgs/cover-image-playground.webp: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/WordPress/blueprints/9552309fcca0d3fa8718ff7279601e48f7074631/blueprints/welcome/assets/imgs/cover-image-playground.webp -------------------------------------------------------------------------------- /blueprints/welcome/assets/imgs/playground-logo-150x150.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/WordPress/blueprints/9552309fcca0d3fa8718ff7279601e48f7074631/blueprints/welcome/assets/imgs/playground-logo-150x150.png -------------------------------------------------------------------------------- /blueprints/welcome/assets/imgs/playground-logo.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/WordPress/blueprints/9552309fcca0d3fa8718ff7279601e48f7074631/blueprints/welcome/assets/imgs/playground-logo.png -------------------------------------------------------------------------------- /blueprints/welcome/assets/imgs/thumbnail-playground-1.webp: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/WordPress/blueprints/9552309fcca0d3fa8718ff7279601e48f7074631/blueprints/welcome/assets/imgs/thumbnail-playground-1.webp -------------------------------------------------------------------------------- /blueprints/welcome/assets/imgs/thumbnail-playground-2.webp: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/WordPress/blueprints/9552309fcca0d3fa8718ff7279601e48f7074631/blueprints/welcome/assets/imgs/thumbnail-playground-2.webp -------------------------------------------------------------------------------- /blueprints/welcome/assets/imgs/thumbnail-playground-3.webp: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/WordPress/blueprints/9552309fcca0d3fa8718ff7279601e48f7074631/blueprints/welcome/assets/imgs/thumbnail-playground-3.webp -------------------------------------------------------------------------------- /blueprints/welcome/blueprint.json: -------------------------------------------------------------------------------- 1 | { 2 | "$schema": "https://playground.wordpress.net/blueprint-schema.json", 3 | "meta": { 4 | "title": "Playground Welcome Landing Page", 5 | "description": "Landing page for the WordPress Playground giving a quick overview of the features and capabilities of the platform.", 6 | "author": "fellyph", 7 | "categories": ["meta"] 8 | }, 9 | "login": true, 10 | "landingPage": "/hello-from-playground", 11 | "steps": [ 12 | { 13 | "step": "runPHPWithOptions", 14 | "options": { 15 | "code": " 'Hello from WordPress Playground!',\n\t\t\t\t\t\t\t'post_content' => $content,\n\t\t\t\t\t\t\t'post_status' => 'publish',\n\t\t\t\t\t\t\t'post_type' => 'page',\n\t\t\t\t\t\t\t'post_name' => 'hello-from-playground',\n\t\t\t\t\t\t]);\n\t\t\t\t\t\t", 16 | "env": { 17 | "CONTENT": "\n
\"\"
\n
\n
\n

Hello from WordPress Playground!

\n\n\n\n
\n

This is Playground, a WordPress that runs client-side in your browser. It's perfect for training, demonstrating plugins and themes, and for testing purposes.

\n\n\n\n

Note that you are logged-in as admin!
Thus, you can modify this site as you like: edit content, install plugins and play around.

\n\n\n\n

To start over, simply reload the page!

\n
\n\n\n\n\n
\n\n\n\n
\n
\n
\n\n\n\n
\n
\n
\n\n
\n\n\n\n
\n
\n

What is WordPress Playground?

\n\n\n\n

WordPress Playground allows users to experiment and build websites directly within a browser, eliminating the need for local setup.

\n\n\n\n

By leveraging WebAssembly (WASM), it offers a seamless and secure environment that replicates a traditional hosting experience and streamlining workflows.

\n
\n
\n
\n
\n\n\n\n
\n
\n

Explore Blueprints Gallery

\n\n\n\n

With Blueprints you can run a WordPress instance with a pre-defined content. The following examples displays what you can achieve with WordPress Playground + Blueprints.

\n
\n\n\n\n
\n\n\n\n\n\n\n\n\n\n
\n\n\n\n

The Playground community created a directory of blueprint examples, from making posts with wp-cli to showcasing plugins with media. Check out the link below to learn more.

\n\n\n\n
\n\n
\n
\n\n\n\n
\n
\n

How Can WordPress Playground Be Useful to Me?

\n\n\n\n

You've heard about WordPress Playground, but you\u2019re still not sure how it can benefit you? Let\u2019s find out together!

\n\n\n\n
I\u2019m a Theme Author\n

Showcase

\n\n\n\n

As a theme author, WordPress Playground provides a platform to showcase your themes effortlessly. Visitors can experience your design in a live environment without needing a separate installation, which makes it easier for you to attract potential users.

\n\n\n\n

Test

\n\n\n\n

You can test your theme's responsiveness and compatibility across different devices and WordPress versions. WordPress Playground allows you to make adjustments in real-time and see how your theme looks and behaves with various settings and plugins.

\n
\n\n\n\n
\n\n\n\n
I\u2019m a Plugin Author\n

Showcase

\n\n\n\n

If you're developing or maintaining plugins, WordPress Playground can help you showcase your plugin, allowing you to convince future users to choose your plugin by trying it out without you having to maintain any infrastructure.

\n\n\n\n

Test

\n\n\n\n

You can spin up your plugin in different environments to figure out how it interacts with other plugins, confirm and try your onboarding flow, or use Playwright for end-to-end testing of your plugin.

\n
\n\n\n\n
\n\n\n\n
I\u2019m a WordPress Site Owner\n

Experiment

\n\n\n\n

As a WordPress site owner, WordPress Playground lets you experiment with new features, themes, and plugins in a risk-free environment. You can explore enhancements without fear of breaking your live site, giving you the confidence to try new ideas.

\n\n\n\n

Validate

\n\n\n\n

You can validate changes or updates before applying them to your live site, ensuring that everything works as intended. Whether it\u2019s testing a new plugin or trying out a new theme, WordPress Playground helps you make informed decisions.

\n
\n\n\n\n
\n\n\n\n
I\u2019m a WordPress User\n

Learn

\n\n\n\n

If you're exploring WordPress for the first time or looking to enhance your skills, the WordPress Playground is an excellent learning tool. You can practice working with WordPress like trying the Site Editor and gain hands-on experience, all without any risk to a live site.

\n\n\n\n

Build

\n\n\n\n

Create a personal demo site to experiment with widgets, settings, and layouts. This sandbox environment allows you to get comfortable with WordPress, helping you understand how to make the most of the platform for your own projects. You can then export your site to share it with others.

\n
\n
\n
\n\n\n\n
\n
\n

Run Playground in your terminal

\n\n\n\n

Beyond the browser, WordPress Playground is also available as a local CLI tool for developers to build their plugins, themes, and run test automations.

\n\n\n\n
$ npx @wp-playground/cli@latest server
\n\n\n\n\n
\n
\n\n\n\n
\"\"
\n
\n
\n\n\n\n
\n

Test Our Brand New
PHP Playground

\n\n\n\n

This sandbox lets you write, test, and debug code directly from the client-side, which enables instant, shareable, and safe code prototyping in a way that wasn't previously possible.

\n\n\n\n\n
\n
\n
\n\n\n\n
\n
\n
\"\"
\n\n\n\n

Learn more about Playground

\n
\n\n\n\n
\n

Documentation

\n\n\n\n

Slack Channel

\n\n\n\n

GitHub

\n\n\n\n

Playground Blog

\n\n\n\n

Did you find a bug?

\n
\n
\n\n\n\n\n" 18 | } 19 | } 20 | } 21 | ] 22 | } 23 | -------------------------------------------------------------------------------- /blueprints/woo-shipping/blueprint.json: -------------------------------------------------------------------------------- 1 | { 2 | "$schema": "https://playground.wordpress.net/blueprint-schema.json", 3 | "meta": { 4 | "title": "Minimal WooCommerce Setup with Sample Products, Shipping, and Payment Method", 5 | "description": "To create a WordPress Playground instance that installs WooCommerce, adds a custom flat rate shipping method via a plugin, imports WooCommerce sample products XML to demonstrate the shipping method on the cart/checkout pages, and enables the Direct Bank Transfer payment method.", 6 | "author": "calvinrodrigues500", 7 | "categories": ["woocommerce", "shipping", "flat_rate"] 8 | }, 9 | "plugins": ["woocommerce"], 10 | "features": { 11 | "intl": true 12 | }, 13 | "landingPage": "/wp-admin/admin.php?page=wc-settings&tab=shipping", 14 | "steps": [ 15 | { 16 | "step": "importWxr", 17 | "file": { 18 | "resource": "url", 19 | "url": "https://raw.githubusercontent.com/wordpress/blueprints/trunk/blueprints/woo-shipping/sample_products.xml" 20 | } 21 | }, 22 | { 23 | "step": "mkdir", 24 | "path": "/wordpress/wp-content/plugins/woo-shipping-method" 25 | }, 26 | { 27 | "step": "writeFile", 28 | "path": "/wordpress/wp-content/plugins/woo-shipping-method/woo-shipping-method.php", 29 | "data": { 30 | "resource": "url", 31 | "url": "https://raw.githubusercontent.com/wordpress/blueprints/trunk/blueprints/woo-shipping/woo-shipping-method/woo-shipping-method.php" 32 | } 33 | }, 34 | { 35 | "step": "activatePlugin", 36 | "pluginName": "woo-shipping-method", 37 | "pluginPath": "woo-shipping-method/woo-shipping-method.php" 38 | }, 39 | { 40 | "step": "runPHP", 41 | "code": " 5, 'post_title' => 'Sample Product', 'post_content' => '

Sample product description

','post_status' => 'publish','post_type' => 'product','post_author' => 1, 'meta_input' => array('_sku' => 'WEBTOFFEE-FEED-ITEM', '_regular_price' => 25.00, '_sale_price' => 22.00, '_price' => 22.00, '_wt_feed_brand' => 'WebToffee', '_wt_feed_gtin' => 'WEBTOFFEE123', '_wt_feed_mpn' => 'WebToffee123', '_wt_feed_color' => 'Red', '_wt_feed_gender' => 'Male' ) ) );" 42 | } 43 | ], 44 | "siteOptions": { 45 | "blogName": "Woo Shipping Method" 46 | } 47 | } 48 | -------------------------------------------------------------------------------- /blueprints/woo-shipping/woo-shipping-method/woo-shipping-method.php: -------------------------------------------------------------------------------- 1 | get_shipping_methods(); 21 | $method_exists = false; 22 | 23 | foreach ($shipping_methods as $method) { 24 | if ('flat_rate' == $method->id) { 25 | $method_exists = true; 26 | break; 27 | } 28 | } 29 | 30 | if ($method_exists) { 31 | return; 32 | } 33 | 34 | $instance_id = $zone->add_shipping_method('flat_rate'); 35 | 36 | if (!$instance_id) { 37 | return; 38 | } 39 | 40 | $settings = array( 41 | 'title' => __('My Custom Flat Rate', 'woo-shippinqg-method'), 42 | 'cost' => 10, 43 | 'tax_status' => 'none', 44 | ); 45 | 46 | update_option('woocommerce_flat_rate_' . $instance_id . '_settings', $settings); 47 | } 48 | 49 | add_action('init', 'add_flat_rate_shipping_method'); 50 | 51 | /** 52 | * Enable Direct Bank Transfer Payment Gateway. 53 | */ 54 | function enable_bacs_payment_gateway() { 55 | 56 | if (!class_exists('WC_Payment_Gateway')) { 57 | return; 58 | } 59 | 60 | $bacs_settings = get_option('woocommerce_bacs_settings', array()); 61 | 62 | if (!isset($bacs_settings['enabled']) || 'yes' !== $bacs_settings['enabled']) { 63 | $bacs_settings['enabled'] = 'yes'; 64 | update_option('woocommerce_bacs_settings', $bacs_settings); 65 | } 66 | } 67 | 68 | add_action('woocommerce_init', 'enable_bacs_payment_gateway'); 69 | -------------------------------------------------------------------------------- /blueprints/woocommerce-product-feed/blueprint.json: -------------------------------------------------------------------------------- 1 | { 2 | "$schema": "https://playground.wordpress.net/blueprint-schema.json", 3 | "meta": { 4 | "title": "WooCommerce product feed", 5 | "description": "Blueprint to create a WooCommerce product and export an XML/CSV product feed", 6 | "author": "mujuonly", 7 | "categories": ["WooCommerce", "Content"] 8 | }, 9 | "landingPage": "/wp-admin/admin.php?page=webtoffee_product_feed_main_export", 10 | "preferredVersions": { 11 | "php": "latest", 12 | "wp": "latest" 13 | }, 14 | "login": true, 15 | "plugins": ["woocommerce", "webtoffee-product-feed"], 16 | "steps": [ 17 | { 18 | "step": "runPHP", 19 | "code": " 5, 'post_title' => 'Sample Product', 'post_content' => '

Sample product description

','post_status' => 'publish','post_type' => 'product','post_author' => 1, 'meta_input' => array('_sku' => 'WEBTOFFEE-FEED-ITEM', '_regular_price' => 25.00, '_sale_price' => 22.00, '_price' => 22.00, '_wt_feed_brand' => 'WebToffee', '_wt_feed_gtin' => 'WEBTOFFEE123', '_wt_feed_mpn' => 'WebToffee123', '_wt_feed_color' => 'Red', '_wt_feed_gender' => 'Male' ) ) );" 20 | } 21 | ] 22 | } 23 | -------------------------------------------------------------------------------- /blueprints/wpcli-post-with-image/Select-storage-method.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/WordPress/blueprints/9552309fcca0d3fa8718ff7279601e48f7074631/blueprints/wpcli-post-with-image/Select-storage-method.png -------------------------------------------------------------------------------- /blueprints/wpcli-post-with-image/blueprint.json: -------------------------------------------------------------------------------- 1 | { 2 | "$schema": "https://playground.wordpress.net/blueprint-schema.json", 3 | "meta": { 4 | "title": "Use wp-cli to add a post with image", 5 | "description": "Use wp-cli to create a post from text file with block markup and a featured image", 6 | "author": "bph", 7 | "categories": ["Content", "wpcli"] 8 | }, 9 | "landingPage": "/?p=4", 10 | "login": true, 11 | "steps": [ 12 | { 13 | "step": "writeFile", 14 | "path": "/wordpress/wp-content/postcontent.md", 15 | "data": { 16 | "resource": "url", 17 | "url": "https://raw.githubusercontent.com/wordpress/blueprints/trunk/blueprints/wpcli-post-with-image/postcontent.md" 18 | } 19 | }, 20 | { 21 | "step": "writeFile", 22 | "path": "/wordpress/wp-content/Select-storage-method.png", 23 | "data": { 24 | "resource": "url", 25 | "url": "https://raw.githubusercontent.com/wordpress/blueprints/trunk/blueprints/wpcli-post-with-image/Select-storage-method.png" 26 | } 27 | }, 28 | { 29 | "step": "wp-cli", 30 | "command": "wp post create --post_title='Welcome to Playground' --post_status='published' /wordpress/wp-content/postcontent.md" 31 | }, 32 | { 33 | "step": "wp-cli", 34 | "command": "wp media import wordpress/wp-content/Select-storage-method.png --post_id=4 --title='Select your storage method' --featured_image" 35 | } 36 | ] 37 | } 38 | -------------------------------------------------------------------------------- /blueprints/wpcli-post-with-image/postcontent.md: -------------------------------------------------------------------------------- 1 | 2 |

A WordPress space in your browser.

3 | 4 | 5 | 6 |

What can you do with it?

7 | 8 | 9 | 10 |

Test WordPress to your heart's content.

11 | 12 | 13 | 14 |
15 | 16 | 17 | 18 |

By default it's ephemeral. You refresh the browser or close the window, the site you worked is gone. If you change the Storage method, you can work on your site and return to it after a break.

19 | 20 | 21 | 22 |

You have three choices:

23 | 24 | 25 | 26 | 37 | 38 | 39 | -------------------------------------------------------------------------------- /blueprints/wpgraphql/blueprint.json: -------------------------------------------------------------------------------- 1 | { 2 | "$schema": "https://playground.wordpress.net/blueprint-schema.json", 3 | "meta": { 4 | "title": "Use WPGraphQL to query WordPress", 5 | "description": "Example that loads WordPress with WPGraphQL active and defaults to the WPGraphQL IDE page to allow users to test GraphQL queries and explore the GraphQL Schema.", 6 | "author": "jasonbahl", 7 | "categories": ["API", "wpgraphql"] 8 | }, 9 | "landingPage": "/wp-admin/admin.php?page=graphiql-ide&query=I4VwpgTgngBA4mALgBQPYGdHpgbwFAwwAOGWuBhMAdqgCZjb6WUCWtFziLiANmB5VoBDRP2YBfCpPFA", 10 | "plugins": ["wp-graphql"], 11 | "login": true 12 | } 13 | -------------------------------------------------------------------------------- /docs/assets/hello-from-the-dashboard.zip: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/WordPress/blueprints/9552309fcca0d3fa8718ff7279601e48f7074631/docs/assets/hello-from-the-dashboard.zip -------------------------------------------------------------------------------- /docs/assets/installed-adventurer-theme.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/WordPress/blueprints/9552309fcca0d3fa8718ff7279601e48f7074631/docs/assets/installed-adventurer-theme.png -------------------------------------------------------------------------------- /docs/assets/installed-custom-plugin.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/WordPress/blueprints/9552309fcca0d3fa8718ff7279601e48f7074631/docs/assets/installed-custom-plugin.png -------------------------------------------------------------------------------- /docs/assets/schema-autocompletion.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/WordPress/blueprints/9552309fcca0d3fa8718ff7279601e48f7074631/docs/assets/schema-autocompletion.png -------------------------------------------------------------------------------- /docs/build-your-first-blueprint.md: -------------------------------------------------------------------------------- 1 | ## Build your first Blueprint 2 | 3 | Let's build an elementary Blueprint that 4 | 5 | 1. Creates a new WordPress site 6 | 2. Sets the site title to "My first Blueprint" 7 | 3. Installs the _Adventurer_ theme 8 | 4. Installs the _Hello Dolly_ plugin from the WordPress plugin directory 9 | 5. Installs a custom plugin 10 | 6. Changes the site content 11 | 12 | ### 1. Create a new WordPress site 13 | 14 | Let's start by creating a `blueprint.json` file with the following contents: 15 | 16 | ```json 17 | {} 18 | ``` 19 | 20 | It may seem like nothing is happening, but this Blueprint already spins up a WordPress site with the latest major version. 21 | 22 | [
Run Blueprint
](https://playground.wordpress.net/#{}) 23 | 24 | > [!TIP] 25 | > **Autocomplete** 26 | > 27 | >If you use an IDE, like VS Code or PHPStorm, you can use the [Blueprint JSON Schema](https://playground.wordpress.net/blueprint-schema.json) for an autocompleted Blueprint development experience. Add the following line at the top of your `blueprint.json` file: 28 | > 29 | >```json 30 | >{ 31 | > "$schema": "https://playground.wordpress.net/blueprint-schema.json" 32 | >} 33 | >``` 34 | 35 | Here's what it looks like in VS Code: 36 | 37 | ![Autocompletion visualized](./assets/schema-autocompletion.png) 38 | 39 | ### 2. Set the site title to "My first Blueprint" 40 | 41 | Blueprints consist of a series of [steps](https://wordpress.github.io/wordpress-playground/blueprints-api/steps) that define how to build a WordPress site. Before you write the first step, declare an empty list of steps: 42 | 43 | ```json 44 | { 45 | "$schema": "https://playground.wordpress.net/blueprint-schema.json", 46 | "steps": [] 47 | } 48 | ``` 49 | 50 | This Blueprint isn't very exciting—it creates the same default site as the empty Blueprint above. Let's do something about it! 51 | 52 | WordPress stores the site title in the `blogname` option. Add your first step and set that option to "My first Blueprint": 53 | 54 | ```json 55 | { 56 | "$schema": "https://playground.wordpress.net/blueprint-schema.json", 57 | "steps": [ 58 | { 59 | "step": "setSiteOptions", 60 | "options": { 61 | "blogname": "My first Blueprint" 62 | } 63 | } 64 | ] 65 | } 66 | ``` 67 | 68 | [
Run Blueprint
](https://playground.wordpress.net/#https://playground.wordpress.net/#eyIkc2NoZW1hIjoiaHR0cHM6Ly9wbGF5Z3JvdW5kLndvcmRwcmVzcy5uZXQvYmx1ZXByaW50LXNjaGVtYS5qc29uIiwic3RlcHMiOlt7InN0ZXAiOiJzZXRTaXRlT3B0aW9ucyIsIm9wdGlvbnMiOnsiYmxvZ25hbWUiOiJNeSBmaXJzdCBCbHVlcHJpbnQifX1dfQ==) 69 | 70 | The [`setSiteOptions` step](https://wordpress.github.io/wordpress-playground/blueprints-api/steps#SetSiteOptionsStep) specifies the site options in the WordPress database. The `options` object contains the key-value pairs to set. In this case, you changed the value of the `blogname` key to "My first Blueprint". You can read more about all available steps in the [Blueprint Steps API Reference](https://wordpress.github.io/wordpress-playground/blueprints-api/steps). 71 | 72 | ### Shorthands 73 | 74 | You can specify some steps using a shorthand syntax. For example, you could write the `setSiteOptions` step like this: 75 | 76 | ```json 77 | { 78 | "$schema": "https://playground.wordpress.net/blueprint-schema.json", 79 | "siteOptions": { 80 | "blogname": "My first Blueprint" 81 | } 82 | } 83 | ``` 84 | 85 | Every step specified with the shorthand syntax is automatically added at the beginning of the Blueprint's execution, before any explicitly defined `steps` array. The order among multiple shorthands is not guaranteed. Which should you choose? Use shorthands when brevity is your main concern, and use explicit steps when you require more control over the order of execution. 86 | 87 | ### 3. Install the _Adventurer_ theme 88 | 89 | Adventurer is an open-source theme [available in the WordPress theme directory](https://wordpress.org/themes/adventurer/). Let's install it using the [`installTheme` step](https://wordpress.github.io/wordpress-playground/blueprints-api/steps#InstallThemeStep): 90 | 91 | ```json 92 | { 93 | "siteOptions": { 94 | "blogname": "My first Blueprint" 95 | }, 96 | "steps": [ 97 | { 98 | "step": "installTheme", 99 | "themeZipFile": { 100 | "resource": "wordpress.org/themes", 101 | "slug": "adventurer" 102 | } 103 | } 104 | ] 105 | } 106 | ``` 107 | 108 | [
Run Blueprint
](https://playground.wordpress.net/#eyIkc2NoZW1hIjoiaHR0cHM6Ly9wbGF5Z3JvdW5kLndvcmRwcmVzcy5uZXQvYmx1ZXByaW50LXNjaGVtYS5qc29uIiwib3B0aW9ucyI6eyJibG9nbmFtZSI6Ik15IGZpcnN0IEJsdWVwcmludCJ9LCJzdGVwcyI6W3sic3RlcCI6Imluc3RhbGxUaGVtZSIsInRoZW1lWmlwRmlsZSI6eyJyZXNvdXJjZSI6IndvcmRwcmVzcy5vcmcvdGhlbWVzIiwic2x1ZyI6ImFkdmVudHVyZXIifX1dfQ==) 109 | 110 | The site should now look like the screenshot below: 111 | 112 | ![Site with the adventurer theme](./assets/installed-adventurer-theme.png) 113 | 114 | ### Resources 115 | 116 | The `themeZipFile` defines a [resource](https://wordpress.github.io/wordpress-playground/blueprints-api/resources/) and references an external file required to complete the step. Playground supports different types of resources, including 117 | - `url`, 118 | - `wordpress.org/themes`, 119 | - `wordpress.org/plugins`, 120 | - `vfs`(virtual file system), or 121 | - `literal`. 122 | 123 | The example uses the `wordpress.org/themes` resource, which requires a `slug` identical to the one used in WordPress theme directory: 124 | 125 | In this case, `https://wordpress.org/themes//` becomes `https://wordpress.org/themes/adventurer/`. 126 | 127 | > [!NOTE] 128 | > Learn more about the supported resources in the [Blueprint Resources API Reference](https://wordpress.github.io/wordpress-playground/blueprints-api/resources/). 129 | 130 | ### 4. Install the _Hello Dolly_ plugin 131 | 132 | A classic WordPress plugin that displays random lyrics from the song "Hello, Dolly!" in the admin dashboard. Let's install it using the [`installPlugin` step](https://wordpress.github.io/wordpress-playground/blueprints-api/steps#InstallPluginStep): 133 | 134 | ```json 135 | { 136 | "siteOptions": { 137 | "blogname": "My first Blueprint" 138 | }, 139 | "steps": [ 140 | { 141 | "step": "installTheme", 142 | "themeZipFile": { 143 | "resource": "wordpress.org/themes", 144 | "slug": "adventurer" 145 | } 146 | }, 147 | { 148 | "step": "installPlugin", 149 | "pluginZipFile": { 150 | "resource": "wordpress.org/plugins", 151 | "slug": "hello-dolly" 152 | } 153 | } 154 | ] 155 | } 156 | ``` 157 | 158 | [
Run Blueprint
](https://playground.wordpress.net/#eyJzaXRlT3B0aW9ucyI6eyJibG9nbmFtZSI6Ik15IGZpcnN0IEJsdWVwcmludCJ9LCJzdGVwcyI6W3sic3RlcCI6Imluc3RhbGxUaGVtZSIsInRoZW1lWmlwRmlsZSI6eyJyZXNvdXJjZSI6IndvcmRwcmVzcy5vcmcvdGhlbWVzIiwic2x1ZyI6ImFkdmVudHVyZXIifX0seyJzdGVwIjoiaW5zdGFsbFBsdWdpbiIsInBsdWdpblppcEZpbGUiOnsicmVzb3VyY2UiOiJ3b3JkcHJlc3Mub3JnL3BsdWdpbnMiLCJzbHVnIjoiaGVsbG8tZG9sbHkifX1dfQ==) 159 | 160 | The Hello Dolly plugin is now installed and activated. 161 | 162 | Like the `themeZipFile`, the `pluginZipFile` defines a reference to an external file required for the step. The example uses the `wordpress.org/plugins` resource to install the plugin with the matching `slug` from the WordPress plugin directory. 163 | 164 | ### 5. Install a custom plugin 165 | 166 | Let's install a custom WordPress plugin that adds a message to the admin dashboard: 167 | 168 | ```php 169 | Hello from My Custom Plugin!'; 179 | } 180 | 181 | add_action('admin_notices', 'my_custom_plugin'); 182 | ``` 183 | 184 | While you could use the [installPlugin](https://wordpress.github.io/wordpress-playground/blueprints-api/steps#InstallPluginStep) step for this, it typically requires creating a ZIP file. To demonstrate direct file creation and activation, let's start with something different: 185 | 186 | 1. Create a `wp-content/plugins/hello-from-the-dashboard` directory using the [`mkdir` step](https://wordpress.github.io/wordpress-playground/blueprints-api/steps#MkdirStep). 187 | 2. Write a `plugin.php` file using the [`writeFile` step](https://wordpress.github.io/wordpress-playground/blueprints-api/steps#WriteFileStep). 188 | 3. Activate the plugin using the [`activatePlugin` step](https://wordpress.github.io/wordpress-playground/blueprints-api/steps#ActivatePluginStep). 189 | 190 | Here's what that looks like in a Blueprint: 191 | 192 | ```json 193 | { 194 | // ... 195 | "steps": [ 196 | // ... 197 | { 198 | "step": "mkdir", 199 | "path": "/wordpress/wp-content/plugins/hello-from-the-dashboard" 200 | }, 201 | { 202 | "step": "writeFile", 203 | "path": "/wordpress/wp-content/plugins/hello-from-the-dashboard/plugin.php", 204 | "data": "Hello from My Custom Plugin!';\n}\n\nadd_action('admin_notices', 'my_custom_plugin');" 205 | }, 206 | { 207 | "step": "activatePlugin", 208 | "pluginPath": "hello-from-the-dashboard/plugin.php" 209 | } 210 | ] 211 | } 212 | ``` 213 | 214 | The last thing to do is log the user in as an admin. You can do that with a shorthand of the [`login` step](https://wordpress.github.io/wordpress-playground/blueprints-api/steps#LoginStep): 215 | 216 | ```json 217 | { 218 | "login": true, 219 | "steps": { 220 | // ... 221 | } 222 | } 223 | ``` 224 | 225 | Here's the complete Blueprint: 226 | 227 | ```json 228 | { 229 | "$schema": "https://playground.wordpress.net/blueprint-schema.json", 230 | "login": true, 231 | "siteOptions": { 232 | "blogname": "My first Blueprint" 233 | }, 234 | "steps": [ 235 | { 236 | "step": "installTheme", 237 | "themeZipFile": { 238 | "resource": "wordpress.org/themes", 239 | "slug": "adventurer" 240 | } 241 | }, 242 | { 243 | "step": "installPlugin", 244 | "pluginZipFile": { 245 | "resource": "wordpress.org/plugins", 246 | "slug": "hello-dolly" 247 | } 248 | }, 249 | { 250 | "step": "mkdir", 251 | "path": "/wordpress/wp-content/plugins/hello-from-the-dashboard" 252 | }, 253 | { 254 | "step": "writeFile", 255 | "path": "/wordpress/wp-content/plugins/hello-from-the-dashboard/plugin.php", 256 | "data": "Hello from My Custom Plugin!';\n}\n\nadd_action('admin_notices', 'my_custom_plugin');" 257 | }, 258 | { 259 | "step": "activatePlugin", 260 | "pluginPath": "hello-from-the-dashboard/plugin.php" 261 | } 262 | ] 263 | } 264 | ``` 265 | 266 | [
Run Blueprint
](https://playground.wordpress.net/#eyJsb2dpbiI6dHJ1ZSwic2l0ZU9wdGlvbnMiOnsiYmxvZ25hbWUiOiJNeSBmaXJzdCBCbHVlcHJpbnQifSwic3RlcHMiOlt7InN0ZXAiOiJpbnN0YWxsVGhlbWUiLCJ0aGVtZVppcEZpbGUiOnsicmVzb3VyY2UiOiJ3b3JkcHJlc3Mub3JnL3RoZW1lcyIsInNsdWciOiJhZHZlbnR1cmVyIn19LHsic3RlcCI6Imluc3RhbGxQbHVnaW4iLCJwbHVnaW5aaXBGaWxlIjp7InJlc291cmNlIjoid29yZHByZXNzLm9yZy9wbHVnaW5zIiwic2x1ZyI6ImhlbGxvLWRvbGx5In19LHsic3RlcCI6Im1rZGlyIiwicGF0aCI6Ii93b3JkcHJlc3Mvd3AtY29udGVudC9wbHVnaW5zL2hlbGxvLW9uLXRoZS1kYXNoYm9hcmQifSx7InN0ZXAiOiJ3cml0ZUZpbGUiLCJwYXRoIjoiL3dvcmRwcmVzcy93cC1jb250ZW50L3BsdWdpbnMvaGVsbG8tb24tdGhlLWRhc2hib2FyZC9wbHVnaW4ucGhwIiwiZGF0YSI6Ijw/cGhwXG4vKlxuUGx1Z2luIE5hbWU6IFwiSGVsbG9cIiBvbiB0aGUgRGFzaGJvYXJkXG5EZXNjcmlwdGlvbjogQSBjdXN0b20gcGx1Z2luIHRvIHNob3djYXNlIFdvcmRQcmVzcyBCbHVlcHJpbnRzXG5WZXJzaW9uOiAxLjBcbkF1dGhvcjogV29yZFByZXNzIENvbnRyaWJ1dG9yc1xuKi9cblxuZnVuY3Rpb24gbXlfY3VzdG9tX3BsdWdpbigpIHtcbiAgICBlY2hvICc8aDE+SGVsbG8gZnJvbSBNeSBDdXN0b20gUGx1Z2luITwvaDE+Jztcbn1cblxuYWRkX2FjdGlvbignYWRtaW5fbm90aWNlcycsICdteV9jdXN0b21fcGx1Z2luJyk7In0seyJzdGVwIjoiYWN0aXZhdGVQbHVnaW4iLCJwbHVnaW5QYXRoIjoiaGVsbG8tb24tdGhlLWRhc2hib2FyZC9wbHVnaW4ucGhwIn1dfQ==) 267 | 268 | That's what it looks like when you navigate to the dashboard: 269 | 270 | ![Site with the custom plugin](./assets/installed-custom-plugin.png) 271 | 272 | ### Create a plugin and zip it 273 | 274 | Encoding PHP files as `JSON` can be useful for quick testing, but it's inconvenient and difficult to read. Instead, create a file with the plugin code, compress it, and use the `ZIP` file as the `resource` in the [`installPlugin` step](https://wordpress.github.io/wordpress-playground/blueprints-api/steps#InstallPluginStep) to install it (the path in the `URL` should match the one in your GitHub repository): 275 | 276 | 277 | ```json 278 | { 279 | "$schema": "https://playground.wordpress.net/blueprint-schema.json", 280 | "login": true, 281 | "siteOptions": { 282 | "blogname": "My first Blueprint" 283 | }, 284 | "steps": [ 285 | { 286 | "step": "installTheme", 287 | "themeZipFile": { 288 | "resource": "wordpress.org/themes", 289 | "slug": "adventurer" 290 | } 291 | }, 292 | { 293 | "step": "installPlugin", 294 | "pluginZipFile": { 295 | "resource": "wordpress.org/plugins", 296 | "slug": "hello-dolly" 297 | } 298 | }, 299 | { 300 | "step": "installPlugin", 301 | "pluginZipFile": { 302 | "resource": "url", 303 | "url": "https://raw.githubusercontent.com/wordpress/blueprints/trunk/docs/assets/hello-from-the-dashboard.zip" 304 | } 305 | } 306 | ] 307 | } 308 | ``` 309 | 310 | You can shorten that Blueprint even more using the shorthand syntax: 311 | 312 | ```json 313 | { 314 | "$schema": "https://playground.wordpress.net/blueprint-schema.json", 315 | "login": true, 316 | "siteOptions": { 317 | "blogname": "My first Blueprint" 318 | }, 319 | "plugins": [ 320 | "hello-dolly", 321 | "https://raw.githubusercontent.com/wordpress/blueprints/trunk/docs/assets/hello-from-the-dashboard.zip" 322 | ], 323 | "steps": [ 324 | { 325 | "step": "installTheme", 326 | "themeZipFile": { 327 | "resource": "wordpress.org/themes", 328 | "slug": "adventurer" 329 | } 330 | } 331 | ] 332 | } 333 | ``` 334 | 335 | [
Run Blueprint
](https://playground.wordpress.net/#eyIkc2NoZW1hIjoiaHR0cHM6Ly9wbGF5Z3JvdW5kLndvcmRwcmVzcy5uZXQvYmx1ZXByaW50LXNjaGVtYS5qc29uIiwibG9naW4iOnRydWUsInNpdGVPcHRpb25zIjp7ImJsb2duYW1lIjoiTXkgZmlyc3QgQmx1ZXByaW50In0sInBsdWdpbnMiOlsiaGVsbG8tZG9sbHkiLCJodHRwczovL3Jhdy5naXRodWJ1c2VyY29udGVudC5jb20vYWRhbXppZWwvYmx1ZXByaW50cy90cnVuay9kb2NzL2hlbGxvLW9uLXRoZS1kYXNoYm9hcmQuemlwIl0sInN0ZXBzIjpbeyJzdGVwIjoiaW5zdGFsbFRoZW1lIiwidGhlbWVaaXBGaWxlIjp7InJlc291cmNlIjoid29yZHByZXNzLm9yZy90aGVtZXMiLCJzbHVnIjoiYWR2ZW50dXJlciJ9fV19) 336 | 337 | ### 6. Change the site content 338 | 339 | Finally, let's delete the default content of the site and import a new one from a WordPress export file (WXR). 340 | 341 | ### Delete the old content 342 | 343 | While there isn't a dedicated Blueprint step to delete default content, you can achieve this using a snippet of PHP code via the `runPHP` step: 344 | 345 | ```php 346 | -1, 352 | 'post_type' => array('post', 'page'), 353 | 'post_status' => 'any' 354 | )); 355 | 356 | foreach ($posts as $post) { 357 | wp_delete_post($post->ID, true); 358 | } 359 | ``` 360 | 361 | To run that code during the site setup, use the [`runPHP` step](https://wordpress.github.io/wordpress-playground/blueprints-api/steps#RunPHPStep): 362 | 363 | 364 | ```json 365 | { 366 | // ... 367 | "steps": [ 368 | // ... 369 | { 370 | "step": "runPHP", 371 | "code": " -1,\n 'post_type' => array('post', 'page'),\n 'post_status' => 'any'\n));\n\nforeach ($posts as $post) {\n wp_delete_post($post->ID, true);\n}" 372 | } 373 | ] 374 | } 375 | ``` 376 | 377 | ### Import the new content 378 | 379 | Let's use the [`importWxr` step](https://wordpress.github.io/wordpress-playground/blueprints-api/steps#ImportWXRStep) to import a WordPress export (`WXR`) file that helps test WordPress themes. The file is available in the [WordPress/theme-test-data](https://github.com/WordPress/theme-test-data) repository, and you can access it via its `raw.githubusercontent.com` address: [https://raw.githubusercontent.com/WordPress/theme-test-data/master/themeunittestdata.wordpress.xml](https://raw.githubusercontent.com/WordPress/theme-test-data/master/themeunittestdata.wordpress.xml). 380 | 381 | Here's what the final Blueprint looks like: 382 | 383 | ```json 384 | { 385 | "$schema": "https://playground.wordpress.net/blueprint-schema.json", 386 | "login": true, 387 | "siteOptions": { 388 | "blogname": "My first Blueprint" 389 | }, 390 | "plugins": [ 391 | "hello-dolly", 392 | "https://raw.githubusercontent.com/wordpress/blueprints/trunk/docs/assets/hello-from-the-dashboard.zip" 393 | ], 394 | "steps": [ 395 | { 396 | "step": "installTheme", 397 | "themeZipFile": { 398 | "resource": "wordpress.org/themes", 399 | "slug": "adventurer" 400 | } 401 | }, 402 | { 403 | "step": "runPHP", 404 | "code": " -1,\n 'post_type' => array('post', 'page'),\n 'post_status' => 'any'\n));\n\nforeach ($posts as $post) {\n wp_delete_post($post->ID, true);\n}" 405 | }, 406 | { 407 | "step": "importWxr", 408 | "file": { 409 | "resource": "url", 410 | "url": "https://raw.githubusercontent.com/WordPress/theme-test-data/master/themeunittestdata.wordpress.xml" 411 | } 412 | } 413 | ] 414 | } 415 | ``` 416 | 417 | [
Run Blueprint
](https://playground.wordpress.net/#eyIkc2NoZW1hIjoiaHR0cHM6Ly9wbGF5Z3JvdW5kLndvcmRwcmVzcy5uZXQvYmx1ZXByaW50LXNjaGVtYS5qc29uIiwibG9naW4iOnRydWUsInNpdGVPcHRpb25zIjp7ImJsb2duYW1lIjoiTXkgZmlyc3QgQmx1ZXByaW50In0sInBsdWdpbnMiOlsiaGVsbG8tZG9sbHkiLCJodHRwczovL3Jhdy5naXRodWJ1c2VyY29udGVudC5jb20vYWRhbXppZWwvYmx1ZXByaW50cy90cnVuay9kb2NzL2Fzc2V0cy9oZWxsby1mcm9tLXRoZS1kYXNoYm9hcmQuemlwIl0sInN0ZXBzIjpbeyJzdGVwIjoiaW5zdGFsbFRoZW1lIiwidGhlbWVaaXBGaWxlIjp7InJlc291cmNlIjoid29yZHByZXNzLm9yZy90aGVtZXMiLCJzbHVnIjoiYWR2ZW50dXJlciJ9fSx7InN0ZXAiOiJydW5QSFAiLCJjb2RlIjoiPD9waHBcbnJlcXVpcmUgJy93b3JkcHJlc3Mvd3AtbG9hZC5waHAnO1xuXG4kcG9zdHMgPSBnZXRfcG9zdHMoYXJyYXkoXG4gICAgJ251bWJlcnBvc3RzJyA9PiAtMSxcbiAgICAncG9zdF90eXBlJyA9PiBhcnJheSgncG9zdCcsICdwYWdlJyksXG4gICAgJ3Bvc3Rfc3RhdHVzJyA9PiAnYW55J1xuKSk7XG5cbmZvcmVhY2ggKCRwb3N0cyBhcyAkcG9zdCkge1xuICAgIHdwX2RlbGV0ZV9wb3N0KCRwb3N0LT5JRCwgdHJ1ZSk7XG59In0seyJzdGVwIjoiaW1wb3J0V3hyIiwiZmlsZSI6eyJyZXNvdXJjZSI6InVybCIsInVybCI6Imh0dHBzOi8vcmF3LmdpdGh1YnVzZXJjb250ZW50LmNvbS9Xb3JkUHJlc3MvdGhlbWUtdGVzdC1kYXRhL21hc3Rlci90aGVtZXVuaXR0ZXN0ZGF0YS53b3JkcHJlc3MueG1sIn19XX0=) 418 | 419 | And that's it. Congratulations on creating your first Blueprint! 🥳 420 | 421 | *** 422 | 423 | **Table of contents** 424 | 1. [What are Blueprints, and what can you do with them?](./what-are-blueprints-what-you-can-do-with-them.md) 425 | 2. [How to load and run Blueprints?](./how-to-load-run-blueprints.md) 426 | 3. 👉 Build your first Blueprint 427 | 4. [Troubleshoot and debug Blueprints](./troubleshoot-debug-blueprints.md) 428 | -------------------------------------------------------------------------------- /docs/how-to-load-run-blueprints.md: -------------------------------------------------------------------------------- 1 | # How to load and run Blueprints 2 | 3 | ## URL fragment 4 | 5 | The fastest way to run Blueprints is to paste one into the URL "fragment" of a WordPress Playground website. Just add a `#` after the `playground.wordpress.net/`. 6 | 7 | Let's say you want to create a Playground with specific versions of WordPress and PHP using the following Blueprint: 8 | 9 | ```json 10 | { 11 | "$schema": "https://playground.wordpress.net/blueprint-schema.json", 12 | "preferredVersions": { 13 | "php": "7.4", 14 | "wp": "5.9" 15 | } 16 | } 17 | ``` 18 | 19 | To run it, go to `https://playground.wordpress.net/#{"preferredVersions": {"php":"7.4", "wp":"5.9"}}`. You can also use the button below: 20 | 21 | [
Run the Blueprint
](https://playground.wordpress.net/#{"preferredVersions":{"php":"7.4","wp":"5.9"}}) 22 | 23 | Use this method to run the example code in the next chapter, [**Build your first Blueprint**](./build-your-first-blueprint.md). 24 | 25 | ### Base64 encoded Blueprints 26 | 27 | Some tools, including GitHub, might not format the Blueprint correctly when pasted into the URL. In such cases, [encode your Blueprint in Base64](https://www.base64encode.org) and append it to the URL. For example, that's the above Blueprint in Base64 format: `eyJwcmVmZXJyZWRWZXJzaW9ucyI6IHsicGhwIjoiNy40IiwgIndwIjoiNS45In19`. 28 | 29 | To run it, go to [https://playground.wordpress.net/#eyJwcmVmZXJyZWRWZXJzaW9ucyI6IHsicGhwIjoiNy40IiwgIndwIjoiNS45In19](https://playground.wordpress.net/#eyJwcmVmZXJyZWRWZXJzaW9ucyI6IHsicGhwIjoiNy40IiwgIndwIjoiNS45In19) 30 | 31 | ### Load Blueprint from a URL 32 | 33 | When your Blueprint gets too wieldy, you can load it via the `?blueprint-url` query parameter in the URL, like this: 34 | 35 | [https://playground.wordpress.net/?blueprint-url=https://raw.githubusercontent.com/wordpress/blueprints/trunk/blueprints/latest-gutenberg/blueprint.json](https://playground.wordpress.net/?blueprint-url=https://raw.githubusercontent.com/wordpress/blueprints/trunk/blueprints/latest-gutenberg/blueprint.json) 36 | 37 | Note that the Blueprint must be publicly accessible and served with [the correct `Access-Control-Allow-Origin` header](https://developer.mozilla.org/en-US/docs/Web/HTTP/Headers/Access-Control-Allow-Origin): 38 | 39 | ``` 40 | Access-Control-Allow-Origin: * 41 | ``` 42 | 43 | *** 44 | 45 | **Table of contents** 46 | 1. [What are Blueprints, and what can you do with them?](./what-are-blueprints-what-you-can-do-with-them.md) 47 | 2. 👉 How to load and run Blueprints? 48 | 3. [Build your first Blueprint](./build-your-first-blueprint.md) 49 | 4. [Troubleshoot and debug Blueprints](./troubleshoot-debug-blueprints.md) 50 | -------------------------------------------------------------------------------- /docs/index.md: -------------------------------------------------------------------------------- 1 | # Blueprints 101 2 | 3 | Welcome to this comprehensive guide to Blueprints, where you'll find everything you need to know: what they are, how to create them, and how to use them effectively. 4 | 5 | 1. [What are Blueprints, and what can you do with them?](./what-are-blueprints-what-you-can-do-with-them.md) 6 | 2. [How to load and run Blueprints?](./how-to-load-run-blueprints.md) 7 | 3. [Build your first Blueprint](./build-your-first-blueprint.md) 8 | 4. [Troubleshoot and debug Blueprints](./troubleshoot-debug-blueprints.md) 9 | 10 | > [!NOTE] 11 | > ## Blueprints version 2 12 | > The team is exploring ways to transition Blueprints from their current TypeScript implementation to a PHP-based library. This would enable Blueprints to run in any WordPress environment, including Playground, a hosted site, or a local setup. 13 | > 14 | > The proposed [new specification](https://github.com/WordPress/blueprints-library/issues/6) is discussed on a separate [GitHub repository](https://github.com/WordPress/blueprints-library/), and you’re more than welcome to join (there or on the [#meta-playground](https://wordpress.slack.com/archives/C04EWKGDJ0K) Slack channel) and help shape the next generation of Playground. 15 | -------------------------------------------------------------------------------- /docs/troubleshoot-debug-blueprints.md: -------------------------------------------------------------------------------- 1 | # Troubleshoot and debug Blueprints 2 | 3 | When you build Blueprints, you might run into issues. Here are tips and tools to help you debug them: 4 | 5 | ## Review common gotchas 6 | 7 | - Require `wp-load`: to run a WordPress PHP function using the `runPHP` step, you would need to require [wp-load.php](https://github.com/WordPress/WordPress/blob/master/wp-load.php). So, the value of the `code` key should start with `" [!CAUTION] 14 | > The editor is currently under development, and the embedded Playground sometimes fails to load. If this happens, refresh the page. We are aware of this issue and are working to improve the experience. 15 | 16 | ## Check for errors in the browser console 17 | 18 | If your Blueprint isn’t running as expected, open the browser developer tools to see if there are any errors. 19 | 20 | To open the developer tools in Chrome, Firefox, Safari*, and Edge: press `Ctrl + Shift + I` on Windows/Linux or `Cmd + Option + I` on macOS. 21 | 22 | > [!WARNING] 23 | > If you haven't yet, enable the Develop menu: go to **Safari > Settings... > Advanced** and check **Show features for web developers**. 24 | 25 | The developer tools window allows you to inspect network requests, view console logs, debug JavaScript, and examine the DOM and CSS styles applied to your webpage. This is crucial for diagnosing and fixing issues with Blueprints. 26 | 27 | ## Ask for help 28 | 29 | The community is here to help! If you have questions or comments, [open a new issue](https://github.com/wordpress/blueprints/issues) in this repository. Remember to include the following details: 30 | 31 | - The Blueprint you’re trying to run. 32 | - The error message you’re seeing, if any. 33 | - The full output from the browser developer tools. 34 | - Any other relevant information that might help us understand the issue: OS, browser version, etc. 35 | 36 | *** 37 | 38 | **Table of contents** 39 | 1. [What are Blueprints, and what can you do with them?](./what-are-blueprints-what-you-can-do-with-them.md) 40 | 2. [How to load and run Blueprints?](./how-to-load-run-blueprints.md) 41 | 3. [Build your first Blueprint](./build-your-first-blueprint.md) 42 | 4. 👉 Troubleshoot and debug Blueprints 43 | -------------------------------------------------------------------------------- /docs/what-are-blueprints-what-you-can-do-with-them.md: -------------------------------------------------------------------------------- 1 | # What are Blueprints, and what can you do with them? 2 | 3 | WordPress Playground allows you to create an entire website, including plugins, themes, content (posts, pages, taxonomy, comments), settings (site name, users, permalinks), and more. Blueprints allow you to generate a WooCommerce store complete with products, a magazine populated with articles, a corporate blog with multiple users, and more. 4 | 5 | Blueprints are `JSON` files that you can use to configure Playground instances. 6 | 7 | Blueprints support advanced use cases, like file system and database manipulation, and give you fine-grained control over the instance you create. The WordPress Test Team has been using Playground in [the 6.5 beta release cycle](https://wordpress.org/news/2024/03/wordpress-6-5-release-candidate-2/), creating a Blueprint that loads the latest version, several testing plugins, and dummy data. 8 | 9 | ## A simple example 10 | 11 | A Blueprint might look something like this: 12 | 13 | ```json 14 | { 15 | "plugins": ["akismet", "gutenberg"], 16 | "themes": ["twentynineteen"], 17 | "settings": { 18 | "blogname": "My Blog", 19 | "blogdescription": "Just another WordPress site" 20 | }, 21 | "constants": { 22 | "WP_DEBUG": true 23 | } 24 | } 25 | ``` 26 | 27 | The Blueprint above installs the _Akismet_ and _Gutenberg_ plugins and the _Twenty Nineteen_ theme, sets the site name and description, and enables the WordPress debugging mode. 28 | 29 | ## The benefits of Blueprints 30 | 31 | Blueprints are an invaluable tool for building WordPress sites via Playground 32 | 33 | - **Flexibility**: developers can make granular adjustments to the build process. 34 | - **Consistency**: ensure that every new site starts with the same configuration. 35 | - **Lightweight**: small text files that are easy to store and transfer. 36 | - **Transparency**: A Blueprint includes all the commands needed to build a snapshot of a WordPress site. You can read through it and understand how the site is built. 37 | - **Productivity**: reduces the time-consuming process of manually setting up a new WordPress site. Instead of installing and configuring themes and plugins for each new project, apply a Blueprint and set everything in one process. 38 | - **Up-to-date dependencies**: fetch the latest version of WordPress, a particular plugin, or a theme. Your snapshot is always up to date with the latest features and security fixes. 39 | - **Collaboration**: the `JSON` files are easy to review in tools like GitHub. Share Blueprints with your team or the WordPress community. Allowing others to use your well-configured setup. 40 | - **Experimentation and Learning**: For those new to WordPress or looking to experiment with different configurations, Blueprints provide a safe and easy way to try new setups without "breaking" a live site. 41 | - **WordPress.org integration**: offer a [demo of your plugin](https://developer.wordpress.org/plugins/wordpress-org/previews-and-blueprints/) in the WordPress plugin directory, or a preview in a [Theme Trac ticket](https://meta.trac.wordpress.org/ticket/7382). 42 | - **Spinning a development environment**: A new developer in the team could download the Blueprint, run the CLI `npx @wp-playground/cli server-- blueprint=`, and get a fresh developer environment—loaded with everything they need. The entire CI/CD process can reuse the exact Blueprint. 43 | 44 | > [!NOTE] 45 | > **More Resources** 46 | > Visit these links to learn more about the (endless) possibilities of Blueprints: 47 | > 48 | > - [Introduction to WordPress Playground](https://developer.wordpress.org/news/2024/04/05/introduction-to-playground-running-wordpress-in-the-browser/) 49 | > - Embed a pre-configured WordPress site into your website using the [WordPress Playground Block](https://wordpress.org/plugins/interactive-code-block/). 50 | > - [Blueprints examples](https://wordpress.github.io/wordpress-playground/blueprints-api/examples) 51 | > - [Demos and apps built with Blueprints](https://wordpress.github.io/wordpress-playground/links-and-resources#apps-built-with-wordpress-playground) 52 | 53 | *** 54 | 55 | **Table of contents** 56 | 1. 👉 What are Blueprints, and what can you do with them? 57 | 2. [How to load and run Blueprints?](./how-to-load-run-blueprints.md) 58 | 3. [Build your first Blueprint](./build-your-first-blueprint.md) 59 | 4. [Troubleshoot and debug Blueprints](./troubleshoot-debug-blueprints.md) 60 | -------------------------------------------------------------------------------- /index.json: -------------------------------------------------------------------------------- 1 | { 2 | "blueprints/friends-cors/blueprint.json": { 3 | "title": "Feed Reader with the Friends Plugin", 4 | "description": "By using the Friends plugin, you can read feeds from the web in Playground, and even via ActivityPub", 5 | "author": "akirk", 6 | "categories": [ 7 | "rss", 8 | "social web" 9 | ] 10 | }, 11 | "blueprints/stylish-press/blueprint.json": { 12 | "title": "Stylish Press", 13 | "description": "A Woo store with custom theme, content, and products.", 14 | "author": "adamziel", 15 | "categories": [ 16 | "Woocommerce", 17 | "Site" 18 | ] 19 | }, 20 | "blueprints/create-block-theme/blueprint.json": { 21 | "title": "Create Block Theme", 22 | "description": "Blueprint to install Create Block Theme and start editing right away", 23 | "author": "jonathanbossenger", 24 | "categories": [ 25 | "Editor", 26 | "theme" 27 | ] 28 | }, 29 | "blueprints/user-meta/blueprint.json": { 30 | "title": "Creating a new user for the blog", 31 | "description": "This is a simple example to update user meta data", 32 | "author": "fellyph", 33 | "categories": [ 34 | "meta" 35 | ] 36 | }, 37 | "blueprints/custom-post/blueprint.json": { 38 | "title": "Custom Post Type: Books", 39 | "description": "Blueprint that added a custom post type to playground", 40 | "author": "bph", 41 | "categories": [ 42 | "Content", 43 | "CPT" 44 | ] 45 | }, 46 | "blueprints/tt5-demo/blueprint.json": { 47 | "title": "Demo of Twenty-Twenty-Five theme", 48 | "description": "Blueprint with demo content for the Twenty-Twenty-Five default theme", 49 | "author": "bph", 50 | "categories": [ 51 | "Themes", 52 | "default" 53 | ] 54 | }, 55 | "blueprints/admin-notice/blueprint.json": { 56 | "title": "Display Admin Notice ", 57 | "description": "Blueprint to add a tiny mu-plugin and display an admin notice", 58 | "author": "bph", 59 | "categories": [ 60 | "Admin", 61 | "notices" 62 | ] 63 | }, 64 | "blueprints/gb-more-experiments/blueprint.json": { 65 | "title": "Enable all three Dataview Experiments in Gutenberg", 66 | "author": "bph", 67 | "description": "Blueprint example to enable multiple Experiments within the Gutenberg plugin ", 68 | "categories": [ 69 | "Gutenberg", 70 | "Experiments" 71 | ] 72 | }, 73 | "blueprints/fancy-dashboard_widget/blueprint.json": { 74 | "title": "Fancy Dashboard Widget", 75 | "description": "A blueprint to display statistics about users, posts and comments on a WordPress site.", 76 | "author": "muryamsultana" 77 | }, 78 | "blueprints/grid-variations/blueprint.json": { 79 | "title": "Grid Variations Experiments enabled", 80 | "author": "bph", 81 | "description": "Blueprint example to toggle on enable a feature from the Experiments page in Gutenberg plugin", 82 | "categories": [ 83 | "Gutenberg", 84 | "Experiments" 85 | ] 86 | }, 87 | "blueprints/theme-starter-content/blueprint.json": { 88 | "title": "Import Theme Starter Content", 89 | "author": "bph", 90 | "description": "Blueprint to install a theme with starter content, (here: Twenty-Twenty-One)", 91 | "categories": [ 92 | "Themes", 93 | "Starter Content" 94 | ] 95 | }, 96 | "blueprints/file-starter-content/blueprint.json": { 97 | "title": "Import a standalone starter content via a blueprint step", 98 | "author": "bph", 99 | "description": "Blueprint to use a stand-alone starter content file and then to import it. Click on 'Subscriptions'", 100 | "categories": [ 101 | "Themes", 102 | "Starter Content" 103 | ] 104 | }, 105 | "blueprints/translations/blueprint.json": { 106 | "title": "Install WordPress language packs", 107 | "author": "adamziel", 108 | "description": "Installs and activates the latest WordPress Japanese translation pack from https://translate.wordpress.org/ \u2013 both for WordPress core and for the friends plugin.", 109 | "categories": [ 110 | "core" 111 | ] 112 | }, 113 | "blueprints/install-plugin-from-gist/blueprint.json": { 114 | "title": "Install plugin from a gist", 115 | "author": "zieladam", 116 | "description": "Install and activate a WordPress plugin from a .php file stored in a gist.", 117 | "categories": [ 118 | "plugins" 119 | ] 120 | }, 121 | "blueprints/latest-gutenberg/blueprint.json": { 122 | "title": "Latest Gutenberg plugin", 123 | "author": "zieladam", 124 | "description": "A preview of the latest version of the Gutenberg plugin.", 125 | "categories": [ 126 | "plugins" 127 | ] 128 | }, 129 | "blueprints/install-activate-setup-theme-from-gh-repo/blueprint.json": { 130 | "title": "Loading, activating, and configuring a theme from a GitHub repository.", 131 | "description": "This is a good example of typical steps used on a theme's loading, activation and configuration", 132 | "author": "richtabor", 133 | "categories": [ 134 | "theme" 135 | ] 136 | }, 137 | "blueprints/login-as-editor/blueprint.json": { 138 | "title": "Login as an editor", 139 | "description": "Test WordPress functionality as an editor rather than an administrator.", 140 | "author": "bacoords", 141 | "categories": [ 142 | "User", 143 | "Role" 144 | ] 145 | }, 146 | "blueprints/blocky-formats/blueprint.json": { 147 | "title": "Markdown and Trac Syntax Editor", 148 | "description": "Edit Markdown and Trac formatting in the block editor thanks to the blocky-formats plugin!", 149 | "author": "adamziel", 150 | "categories": [ 151 | "block-editor" 152 | ] 153 | }, 154 | "blueprints/woo-shipping/blueprint.json": { 155 | "title": "Minimal WooCommerce Setup with Sample Products, Shipping, and Payment Method", 156 | "description": "To create a WordPress Playground instance that installs WooCommerce, adds a custom flat rate shipping method via a plugin, imports WooCommerce sample products XML to demonstrate the shipping method on the cart/checkout pages, and enables the Direct Bank Transfer payment method.", 157 | "author": "calvinrodrigues500", 158 | "categories": [ 159 | "woocommerce", 160 | "shipping", 161 | "flat_rate" 162 | ] 163 | }, 164 | "blueprints/welcome/blueprint.json": { 165 | "title": "Playground Welcome Landing Page", 166 | "description": "Landing page for the WordPress Playground giving a quick overview of the features and capabilities of the platform.", 167 | "author": "fellyph", 168 | "categories": [ 169 | "meta" 170 | ] 171 | }, 172 | "blueprints/use-pretty-permalinks/blueprint.json": { 173 | "title": "Pretty permalinks", 174 | "description": "Set the permalink structure to use pretty permalinks.", 175 | "author": "bgrgicak", 176 | "categories": [ 177 | "Settings" 178 | ] 179 | }, 180 | "blueprints/reset-data-and-import-content/blueprint.json": { 181 | "title": "Reset data and import content (with logs)", 182 | "description": "It resets default data before importing custom content. It also logs the state of the content after each step.", 183 | "author": "juanmaguitar", 184 | "categories": [ 185 | "reset", 186 | "log", 187 | "debug", 188 | "debug", 189 | "import", 190 | "content" 191 | ] 192 | }, 193 | "blueprints/redirect-upload-requests/blueprint.json": { 194 | "title": "Serve media files from another host", 195 | "description": "Redirect any requests to files within the uploads directory to an external host. This is useful when you have a lot of image attachments in your playground but don\u2019t want to include them all in the blueprint.", 196 | "author": "ivanblagdan", 197 | "categories": [ 198 | "Settings" 199 | ] 200 | }, 201 | "blueprints/set-admin-color-scheme/blueprint.json": { 202 | "title": "Set the admin color scheme", 203 | "description": "Set the admin color scheme to Modern using the updateUserMeta step.", 204 | "author": "ndiego", 205 | "categories": [ 206 | "user meta" 207 | ] 208 | }, 209 | "blueprints/showcase-plugin-with-media/blueprint.json": { 210 | "title": "Showcase plugin", 211 | "description": "Showcase custom plugin from own server with media files and content imported as WXR. There is a readme file in github repository (https://github.com/Lovor01/blueprints/blob/trunk/blueprints/showcase-plugin-with-media/readme.md) which explains all steps.", 212 | "author": "Lovor01", 213 | "categories": [ 214 | "plugin", 215 | "demo", 216 | "media", 217 | "images" 218 | ] 219 | }, 220 | "blueprints/theme-a11y-test/blueprint.json": { 221 | "title": "Theme Tester", 222 | "description": "Blueprint example to add content and plugins to explore a theme", 223 | "author": "bph", 224 | "categories": [ 225 | "themes", 226 | "content" 227 | ] 228 | }, 229 | "blueprints/wpgraphql/blueprint.json": { 230 | "title": "Use WPGraphQL to query WordPress", 231 | "description": "Example that loads WordPress with WPGraphQL active and defaults to the WPGraphQL IDE page to allow users to test GraphQL queries and explore the GraphQL Schema.", 232 | "author": "jasonbahl", 233 | "categories": [ 234 | "API", 235 | "wpgraphql" 236 | ] 237 | }, 238 | "blueprints/posts-via-wp-cli/blueprint.json": { 239 | "title": "Use wp-cli command to add posts", 240 | "description": "Blueprint example to add posts via a wp-cli command.", 241 | "author": "bph", 242 | "categories": [ 243 | "Content", 244 | "wpcli" 245 | ] 246 | }, 247 | "blueprints/wpcli-post-with-image/blueprint.json": { 248 | "title": "Use wp-cli to add a post with image", 249 | "description": "Use wp-cli to create a post from text file with block markup and a featured image", 250 | "author": "bph", 251 | "categories": [ 252 | "Content", 253 | "wpcli" 254 | ] 255 | }, 256 | "blueprints/woocommerce-product-feed/blueprint.json": { 257 | "title": "WooCommerce product feed", 258 | "description": "Blueprint to create a WooCommerce product and export an XML/CSV product feed", 259 | "author": "mujuonly", 260 | "categories": [ 261 | "WooCommerce", 262 | "Content" 263 | ] 264 | }, 265 | "blueprints/beta-rc/blueprint.json": { 266 | "title": "WordPress Beta", 267 | "description": "Test the latest WordPress Beta or RC release with theme test data and debugging plugins. Only loads the Beta version during the Beta period.", 268 | "author": "courtneyr-dev", 269 | "categories": [ 270 | "Testing" 271 | ] 272 | } 273 | } -------------------------------------------------------------------------------- /reindex_postprocess.py: -------------------------------------------------------------------------------- 1 | import json 2 | import os 3 | import re 4 | import sys 5 | 6 | highlighted_blueprints = [ 7 | 'Stylish Press', 8 | 'Feed Reader with the Friends Plugin' 9 | ] 10 | 11 | def build_json_index(): 12 | index = {} 13 | for root, dirs, files in os.walk('blueprints'): 14 | for file in files: 15 | if file == 'blueprint.json': 16 | path = os.path.join(root, file) 17 | with open(path, 'r') as f: 18 | data = json.load(f) 19 | meta = data.get('meta', {}) 20 | index[path] = meta 21 | # Sort index alphabetically by title 22 | index = dict(sorted(index.items(), key=lambda item: ( 23 | item[1].get('title', '') not in highlighted_blueprints, 24 | item[1].get('title', '') 25 | ))) 26 | with open('index.json', 'w') as f: 27 | json.dump(index, f, indent=2) 28 | 29 | 30 | def get_dot_template_files(): 31 | dot_template_files = [] 32 | for root, dirs, files in os.walk('.'): 33 | for file in files: 34 | if file.endswith('.template'): 35 | path = os.path.join(root, file) 36 | dot_template_files.append(path) 37 | return dot_template_files 38 | 39 | 40 | def build_markdown_table(): 41 | with open('index.json', 'r') as f: 42 | index = json.load(f) 43 | blueprints_rows = [ 44 | ['Title', 'Description', 'Author', 'Actions', ] 45 | ] 46 | for path, meta in index.items(): 47 | title = meta.get('title', '') 48 | if title in highlighted_blueprints: 49 | title = f"**{title}**" 50 | blueprints_rows.append([ 51 | title, 52 | meta.get('description', ''), 53 | '[@{0}](https://github.com/{0})'.format(meta.get('author', '')) if meta.get('author', '') else '', 54 | '• [Open in Playground](https://playground.wordpress.net/?blueprint-url=https://raw.githubusercontent.com/wordpress/blueprints/trunk/{0})'.format(path) + 55 | '
• [View source](https://github.com/wordpress/blueprints/blob/trunk/{0})'.format(path) + 56 | '
• [Edit](https://playground.wordpress.net/builder/builder.html?blueprint-url=https://raw.githubusercontent.com/wordpress/blueprints/trunk/{0})'.format(path), 57 | ]) 58 | 59 | widths = [max(map(len, col)) for col in zip(*blueprints_rows)] 60 | 61 | def format_row(row): 62 | formatted_row = ' | '.join((val.ljust(width) for val, width in zip(row, widths))) 63 | return '| ' + formatted_row + ' |' 64 | 65 | formatted_rows = [ 66 | format_row(blueprints_rows[0]), 67 | format_row(['-' * len(cell) for cell in blueprints_rows[0]]) 68 | ] 69 | for row in blueprints_rows[1:]: 70 | formatted_rows.append(format_row(row)) 71 | formatted_table = '\n'.join(formatted_rows) 72 | 73 | # Replace "{BLUEPRINTS_TABLE}" in all the *.template files 74 | DOT_TEMPLATE_FILES = get_dot_template_files() 75 | for file in DOT_TEMPLATE_FILES: 76 | with open(file, 'r') as f: 77 | template = f.read() 78 | with open(file.replace('.template', ''), 'w') as f: 79 | f.write(re.sub(r'{BLUEPRINTS_TABLE}', ''.join(formatted_table), template)) 80 | 81 | 82 | def rewrite_branch_urls_to_trunk(): 83 | with open('index.json', 'r') as f: 84 | index = json.load(f) 85 | 86 | for path, meta in index.items(): 87 | with open(path, 'r') as f: 88 | blueprint = f.read() 89 | json_blueprint = json.loads(blueprint) 90 | map_url_resources(json_blueprint, branch_url_mapper) 91 | with open(path, 'w') as f: 92 | f.write(json.dumps(json_blueprint, indent="\t")) 93 | 94 | 95 | def map_url_resources(blueprint_fragment, mapper): 96 | """ 97 | Recursively map URL resources in a blueprint using a mapper function. 98 | A URL resource is a dictionary with a "resource": "url" entry, and a "url" key. 99 | """ 100 | if isinstance(blueprint_fragment, dict): 101 | if 'resource' in blueprint_fragment and blueprint_fragment['resource'] == 'url' and 'url' in blueprint_fragment: 102 | blueprint_fragment['url'] = mapper(blueprint_fragment['url']) 103 | else: 104 | for key, value in blueprint_fragment.items(): 105 | map_url_resources(value, mapper) 106 | elif isinstance(blueprint_fragment, list): 107 | for item in blueprint_fragment: 108 | map_url_resources(item, mapper) 109 | 110 | def branch_url_mapper(url): 111 | """ 112 | Rewrite a raw.githubusercontent.com URL to point to the trunk branch. 113 | 114 | >>> branch_url_mapper('https://raw.githubusercontent.com/wordpress/blueprints/my-branch/blueprint.json') 115 | 'https://raw.githubusercontent.com/wordpress/blueprints/trunk/blueprint.json' 116 | >>> branch_url_mapper('https://raw.githubusercontent.com/wordpress/blueprints/trunk/blueprint.json') 117 | 'https://raw.githubusercontent.com/wordpress/blueprints/trunk/blueprint.json' 118 | """ 119 | if not url.startswith("https://raw.githubusercontent.com"): 120 | return url 121 | return re.sub(r'https://raw.githubusercontent.com/wordpress/blueprints/([^/]+)', r'https://raw.githubusercontent.com/wordpress/blueprints/trunk', url) 122 | 123 | if '--test' in sys.argv: 124 | print("Running doctests") 125 | import doctest 126 | doctest.testmod() 127 | else: 128 | print("Reindexing") 129 | build_json_index() 130 | build_markdown_table() 131 | rewrite_branch_urls_to_trunk() 132 | -------------------------------------------------------------------------------- /requirements.txt: -------------------------------------------------------------------------------- 1 | requests -------------------------------------------------------------------------------- /validate_pr.py: -------------------------------------------------------------------------------- 1 | import os 2 | import re 3 | from jsonschema import Draft7Validator, validate, ValidationError 4 | import json 5 | import sys 6 | import requests 7 | 8 | def validate_blueprints(): 9 | errors = [] 10 | 11 | # Get the list of directories touched in the current branch 12 | touched_dirs = get_touched_directories() 13 | 14 | for dir in touched_dirs: 15 | if not re.match(r'^blueprints/[^/]+$', dir): 16 | continue 17 | blueprint_json_path = os.path.join(dir, 'blueprint.json') 18 | 19 | # Check if blueprint.json file exists 20 | if not os.path.exists(blueprint_json_path): 21 | errors.append(f"Error: {dir}/{blueprint_json_path} file does not exist in this PR.") 22 | continue 23 | 24 | # Read and validate the JSON file 25 | try: 26 | with open(blueprint_json_path, 'r') as f: 27 | blueprint_json = json.load(f) 28 | except json.JSONDecodeError as e: 29 | errors.append(f"Error: Invalid JSON in {blueprint_json_path}: {str(e)}") 30 | continue 31 | 32 | # Validate the Blueprint against the JSON schema 33 | schema_url = 'https://playground.wordpress.net/blueprint-schema.json' 34 | schema = json.loads(requests.get(schema_url).text) 35 | 36 | try: 37 | validate(instance=blueprint_json, schema=schema, cls=Draft7Validator) 38 | except ValidationError as e: 39 | error_path = " > ".join(e.absolute_path) 40 | at_error = f"at {error_path}" if error_path else "at root" 41 | errors.append( 42 | f"Error: {dir}/{blueprint_json_path} does not match the JSON schema.\n" 43 | f"{str(e.message)} {at_error}.\n" 44 | ) 45 | continue 46 | 47 | # Recursively find all urls in the blueprint.json file 48 | urls = find_urls(blueprint_json) 49 | 50 | # Check if the URLs all point to raw.githubusercontent.com/wordpress/blueprints/{CURRENT BRANCH} 51 | urls_valid = True 52 | current_branch = os.environ.get('GITHUB_BRANCH') or os.popen('git rev-parse --abbrev-ref HEAD').read().strip() 53 | for url in urls: 54 | if not url.startswith('https://') and not url.startswith('http://'): 55 | continue 56 | if not url.startswith(f'https://raw.githubusercontent.com/wordpress/blueprints/{current_branch}/'): 57 | urls_valid = False 58 | errors.append( 59 | f"Error: {dir}/{blueprint_json_path} contains a URL that is not allowed: \n* {url}\n" 60 | f"Since the current branch is {current_branch}, the URL should start with \n* https://raw.githubusercontent.com/wordpress/blueprints/{current_branch}/\n" 61 | "In general, all URLs in the blueprint.json file must start with https://raw.githubusercontent.com/wordpress/blueprints/{CURRENT BRANCH}/" 62 | ) 63 | 64 | if not urls_valid: 65 | continue 66 | 67 | if len(errors): 68 | for error in errors: 69 | print(error) 70 | sys.exit(1) 71 | 72 | 73 | def find_urls(obj): 74 | urls = [] 75 | if isinstance(obj, dict): 76 | for key, value in obj.items(): 77 | if key == 'url': 78 | urls.append(value) 79 | urls.extend(find_urls(value)) 80 | elif isinstance(obj, list): 81 | for item in obj: 82 | urls.extend(find_urls(item)) 83 | return urls 84 | 85 | 86 | 87 | def get_touched_directories(): 88 | # Run git diff command to get the list of directories touched in the current branch as compared to 89 | # the point where it was forked from the trunk branch 90 | diff_output = os.popen('git diff --name-only $(git merge-base trunk HEAD)').read() 91 | touched_dirs = set() 92 | 93 | # Extract the directory paths from the diff output 94 | for line in diff_output.splitlines(): 95 | dir_path = os.path.dirname(line) 96 | touched_dirs.add(dir_path) 97 | 98 | return touched_dirs 99 | 100 | # Call the function to validate blueprints 101 | validate_blueprints() --------------------------------------------------------------------------------