WordPress.org

WordPress Developer Blog

Streamlining block theme development with WordPress Playground and GitHub

Streamlining block theme development with WordPress Playground and GitHub

Block themes and the Site Editor have transformed the WordPress design landscape, making professional theme development accessible to designers who prefer visual interfaces over code. This shift opens the ecosystem to a new group of creators who previously relied on external design tools. However, a significant hurdle remains: how can changes made within the Site Editor’s database be extracted into a theme’s file system and integrated into a version-controlled workflow?

This article details a “no-code” development workflow that uses a powerful combination of tools—WordPress Playground, the Create Block Theme (CBT) plugin, and GitHub—to bridge the gap between browser-based design and professional version control.

The core challenge of Site Editor changes

In the WordPress block editor environment, design, and styling exist at four levels:

  • Default mostly the styling and layouts of WordPress Core.
  • Block-level styling can be altered with plugins and overwrites the Default styling.
  • Theme-level styling is the whole suite of design tools, controlled by the active Theme. It overwrites Default and block-level styles and layouts for instance (e.g. template and template parts).
  • User-level styling uses the Design tools within the Site Editor to modify styles and layouts. These changes are stored in the database and overwrite the theme-level styling.

As mentioned, when a designer modifies a template in the Site Editor, those changes are stored in the database as “user-level” customizations. Without a way to sync these changes back to the theme’s files (the “theme level”), they cannot be easily reused on other sites, version-controlled, or protected from being overwritten during updates.

A closer look at the tools

To understand how this workflow bridges the gap between visual design and version-controlled development, it is helpful to look at the specific roles of each tool in the stack.

WordPress Playground runs a full WordPress instance entirely within your web browser using WebAssembly (WASM). It requires no installation, no server setup, and no traditional database. It acts as a “disposable” workbench where you can spin up a specific environment, test designs, and close the tab when finished.

The Create Block Theme (CBT) plugin provides the critical Save Changes to Theme feature. It takes modifications stored in the WordPress database and writes them directly into the theme’s virtual file system within Playground, updating theme.json and HTML templates automatically.

GitHub provides the version control (Git) that allows you to track changes and collaborate. In this workflow, GitHub is the “Permanent Storage.” By connecting Playground to a GitHub repository, you move from “one-off” site building into a professional lifecycle where changes are submitted via Pull Requests (PRs).

Setting up the workbench

The workflow begins by launching a pre-configured Playground instance. You can launch a workbench with the necessary tools already installed by appending plugin slugs to the Playground URL: https://playground.wordpress.net/?plugin=gutenberg&plugin=create-block-theme

Note: Once the instance is loaded, set the storage type to “Browser” within the Playground settings (the site manager icon ) to ensure changes persist if you accidentally refresh the page.

Importing the theme from GitHub

To work on an existing project, the theme must be imported from its GitHub repository:

  1. Open the Playground menu and select Import from GitHub.
  2. Authenticate the connection to GitHub.
  3. Provide the repository URL and specify that the import is a Theme.
  4. Identify the correct directory (usually the root /).

Playground will download the theme files and activate the theme within the browser instance and reload the site.

Designing and syncing changes

With the theme active, modifications are made directly within the Site Editor. After saving changes in the Site Editor, they must be written to the theme files:

  1. Open the CBT sidebar within the editor (click the wrench icon in the top toolbar).
  2. Select Save Changes to Theme.
  3. Optionally select Localize Images to move uploaded media from the database to the theme’s /assets folder. The folder is customizable via a WordPress filter.

This step moves the modifications from the WordPress database into the virtual file system of the Playground instance, preparing them for a GitHub commit.

   

Submitting a Pull Request via Playground

Once the design is synced to the files, the changes can be submitted back to GitHub without leaving the browser:

  1. Open the Playground menu and select Export to GitHub.
  2. Playground automatically populates the repository information.
  3. Enter a descriptive commit message.
  4. Click Create Pull Request.

In the last step, you will find a link to the created GitHub PR, where you can continue submitting it as a code commit.

The developer can then visit GitHub to review the changes and merge the Pull Request into the main project.

Use cases for this workflow

The Designer-to-Developer handoff: A designer works visually in the Site Editor, saves changes via CBT, and submits a PR. The developer reviews the code in GitHub, ensuring it meets standards before merging. This eliminates the “translation” phase from design tools to code.

Rapid prototyping and client previews: Spin up a Playground instance, make requested layout changes visually, and share the project’s Playground URL with the client for instant feedback—without touching a staging server.

Open-source theme contributions: This democratizes contributions. Anyone can click a link to open a theme in Playground, fix a styling bug visually, and submit a PR without ever opening a terminal or a code editor.

By using this powerful combination of tools, the WordPress community is moving toward a future where the distinction between “user” and “developer” continues to blur. This browser-based workflow provides a safe, scalable, and professional way to build the next generation of block themes while maintaining the integrity of version control.

Props to @greenshady and @areziaal for review.

9 responses to “Streamlining block theme development with WordPress Playground and GitHub”

  1. Drivingralle Avatar

    It’s an interessing workflow.
    I would have for the CBT to have an auto-save mode. If you are working on fine tuning a theme the frequent changes are creating so much clicks.

    1. Birgit Pauli-Haack Avatar

      Auto-save is available on the site editor. You only need to hit save changes in the CBT plugin side at only before you want to start the GitHub PR to gather all the updates.

  2. Colin Avatar
    Colin

    This is exciting. The stumbling block I see is my designers not wanting to reinstall the theme from GitHub each time they open a session to work on the theme. Is there a way to include the GitHub theme info like the plugins when the playground launches?

    (Also is there a tool or resource to package up some posts and pages to also include on a playground cold start url)

    1. Birgit Pauli-Haack Avatar

      Wouldn’t it be necessary to get a fresh copy from GitHub to make sure they have the latest version before they create the PR? The step also connects the import with the export later.

      As for the post and pages, you can create a blueprint to load the content into the new WordPress instance. The Blueprint documentation can help you there. Or you can watch a presentation on Playground Blueprints on WordPress TV

      1. Birgit Pauli-Haack Avatar

        I also consulted the Playground team about a way to have designers load a theme directly from GitHub and still be able to create the PR on Export to GitHub. It’s is possible via URL parameters on the Playground call.

        The URL parameters:

        `gh-ensure-auth = yes`
        `ghexport-repo-url = https://github.com/bph/plain-pauli`
        `ghexport-content-type = theme`
        `ghexport-theme = plain-pauli`
        ghexport-playground-root = /wordpress/wp-content/themes/plain-pauli
        ghexport-pr-action = create
        ghexport-allow-include-zip = no

        And end it with `blueprint-url` that includes this step.

        {
        "step": "installTheme",
        "themeData": {
        "resource": "git:directory",
        "url": "https://github.com/bph/plain-pauli",
        "ref": "HEAD"
        },
        "options": {
        "activate": true
        },
        "progress": {
        "caption": "Installing theme from GitHub: bph/plain-pauli"
        }
        }

        Here is an example link with a `test-blueprint.json`

  3. Lance Willett Avatar

    Open-source theme contributions

    Maybe it’s time for me to dust off the default theme contributions, I’m behind a few years since the move to git-based patches. Thanks for this helpful guide!

    1. Birgit Pauli-Haack Avatar

      You are welcome. Thanks for stopping by, Lance, and leave a comment. The Themes team can always use some reinforcements. The Community Themes repo might be a good spot to get started and use the workflow for open-source theme contributions.

  4. Ben Avatar
    Ben

    Great to hear this conversation getting some attention. 😀

    Has the Create Block Theme Plugin become more stable? I was using it for a couple years, but after multiple issues with the saves locking me out from my own templates, overwriting/breaking all my patterns, and other issues, I gave up. Have these issues been improved or resolved?

    1. Birgit Pauli-Haack Avatar

      HI Ben, thanks for reading and taking the time to leave a comment. The Create-Block-Theme plugin received multiple updates in the last couple of years. You can study the changelogs here. It would also be helpful if you log still existing issues on the GitHub repo or via the Support forum, so it gets the attention of developers.

Leave a Reply

Your email address will not be published. Required fields are marked *