Pattern Builder
The Pattern Builder enhances the WordPress Editor to make it easier to build, manage and use Block Patterns.
How does it make it easier?
The WordPress editor already comes with powerful tools to allow users to edit User Patterns – Patterns that are tied to a WordPress instance. And Themes can ship with Theme Patterns that users can drop into their sites. But there’s no way to build and modify those Theme Patterns patterns from the WordPress Editor.
Pattern Builder is a design tool that empowers you to use the WordPress editor to create and edit patterns in your themes. This gives Block Theme Authors the tools they need to make their themes everything they can be.
Additionally Pattern Builder opens the possibility of shipping Synced Patterns with Themes. Previously Synced Patterns were exclusively something that had to be tied to a single WordPress site. But now the power of Synced Patterns is shared with the portability of a WordPress Theme.

*Pattern Builder is a Development Tool. It is intended to be used by Theme Authors, Designers and WordPress Developers who are building themes to share, sell or for clients. It is not intended to be used in production. It can be, and often is, but there are risks involved since it does edit Theme Files directly. If you’re looking for a solution to allow Themes to ship Synced Themes in production you may be interested in the free Synced Patterns for Themes plugin. It’s especially helpful for themes created with Pattern Builder that leverage the Synced Themes capabilities.
How to edit Theme Patterns
How does it make Building Patterns better in WordPress?
Edit Theme Patterns
User the native WordPress editor
Convert User patterns to Theme Patterns
Modify Patterns in any Theme
Synced Patterns
Use powerful Synced Patterns in your Themes
Maintain design integrity
Customize Pattern Content
Generated Content
Internationalization ready content
Clean, generated PHP code
Well formatted Block Markup
Documentation
Instructions for getting started using the powerful new tool for the WordPress Editor.
Installation & Activation
This tool is not yet available on WordPress.org. Download the plugin from this website, upload it to your WordPress site and then activate it! You’ll find all the new helpful bits that Pattern Builder offers in the WordPress Editor (both the Site Editor and the Page Editor).

Browsing and Inserting Patterns
WordPress comes with tools to browse and insert patterns, including patterns created with Pattern Builder. You can’t choose to edit patterns from that interface but it’s still useful for inserting them if that’s a workflow you’re already familiar with. Just click the ‘Block Inserter’ button (the blue Plus at the top-left of the Editor) and choose the ‘Patterns’ tab. You’ll be able to browse and insert all of your patterns from there by clicking or dragging them onto your workspace.
Additionally you can use the new Pattern Builder Browser by clicking the icon in the top-right of the Editor. You’ll likewise be able to click or drag to insert patterns onto your workspace. Alternately you can drag a pattern directly into the ‘List View’ instead of the Editor Workspace for easier placement of your patterns.


Editing Existing Patterns
From the WordPress Full Site Editor you can use the Patterns option to browse all of your patterns just like before. Only now you will notice that ALL of the patterns are considered ‘My Patterns’ (not just ‘User Patterns’). Most importantly none of them are ‘locked’ and you can select any of them to open them in the WordPress Editor to make changes.

Additionally, the Pattern Builder Browser offers the option to edit any pattern from within the WordPress Editor (both the Site Editor and the Page Editor). Open the Pattern Builder Browser with the icon in the top-right and navigate to any collection of patterns. When you hover over a pattern you’ll notice an ‘Edit’ button in the top-right of that pattern. Click that and you will have the opportunity to make change to your pattern right there. Clicking ‘< Back’ in the top of the Editor brings you right back to the page you were editing before.


While you are editing a Pattern you now have some additional options you didn’t have before; especially now that you are able to edit Theme Patterns (the most powerful feature of the Pattern Builder).
The option to change the pattern from ‘Theme’ to ‘User’ can be found in the ‘Pattern Source’ section. Changing a pattern from ‘Synced’ to ‘Unsynced’ can be found in the ‘Pattern Synced Status’ section. Associations (a powerful way to tie a pattern to specific Blocks, Post Types or Template Types) is available in the ‘Pattern Associations’ panel along with the ability to show or hide the pattern from the default Pattern Inserter. You can continue to customize a pattern’s Categories in the ‘Pattern Categories’ panel and any Overrides that you have setup for the pattern are found in the ‘Overrides’ section.

Creating New Patterns
There are Three Ways to create new patterns.
The first is to use the ‘Add Pattern’ in the Site Editor. You’ll be presented with an option to name your pattern, assign it to categories and make it a ‘Synced’ pattern or not. Creating a pattern in this way will create a User Pattern, but you can change this later.

Similarly you can use the Pattern Builder Browser to create a new pattern. Click ‘Create Pattern’ and enter the Title and Description for the pattern. You have the option of choosing if this pattern is a ‘Theme’ or ‘User’ pattern and if it is a ‘Synced’ or ‘Unsynced’ pattern. (All of these options can be changed later.)

Lastly you continue to have the option to create a Pattern from any collection of blocks you have already created. This is a convenient way to create patterns in your workflow. Create a design in a page, template or pattern you are editing, select it and select ‘Create Pattern’ from the menu. The Blocks will be stored as a ‘User’ Pattern (which you can later change to a ‘Theme’ Pattern).

What’s the difference between ‘User’ and ‘Theme’ Patterns?
Both types of patterns are collections of Blocks that can be reused. Both types of patterns are presented to users in the same way.
A ‘User Pattern’ stores the content of the pattern in the WordPress database as a ‘wp_block’ Post Type. It is available only on the site that it was created on (or imported into). They are instantiated as ‘wp:block’ in Gutenberg block markup and reference the ID of their Post. Without the aid of something like Pattern Builder this is the only type of Pattern that can be created or edited in the WordPress Editor. User Patterns have the option of being ‘Synced’ or ‘Unsynced’. User patterns cannot have any dynamic (PHP) logic.
<!-- wp:block {ref:123} /-->
A ‘Theme Pattern’ is stored as a PHP file in your Theme’s ‘/patterns’ folder. They have special metadata that defines their categories, associations, etc. Since they are PHP files they can use PHP logic to do special things (like reference resources like images from your Theme or localize content to make the pattern internationalization ready). Pattern Builder makes use of this by writing PHP logic to make Theme Patterns more powerful. By default Theme Patterns can ONLY be ‘Unsynced Patterns’ but with tools like Pattern Builder and Synced Patterns for Themes a pattern can include additional metadata that allows it to be treated like a ‘synced’ pattern.
<!-- wp:pattern {"slug":"SLUG"} /-->
<?php
/**
* Title: Theme Image Test
* Slug: simple/theme-image-test
* Description: A simple pattern
* Categories: media
* Synced: yes
*/
?>
<!-- wp:group -->
<div class="wp-block-group">
<!-- wp:heading -->
...
What’s the difference between ‘Synced’ and ‘Unsynced’ Patterns?
An ‘Unsynced’ pattern is a starting place for content. When you add an unsynced pattern to your content it’s the same as ‘copy’ and ‘pasting’ content. You’re free to make changes or additions to these patterns without effecting anything else on the site.
‘Synced’ patterns are patterns that remain the same everywhere they are used. When you drop a Synced Pattern into your content that pattern cannot be changed (except for content that has overrides or bindings). This means that you can make design or content changes to that pattern and those changes will be reflected everywhere that pattern is used. Some content in Synced Patterns (namely Paragraph Blocks, Header Blocks, Images and Buttons) can enable ‘overrides’. This allows the content and details of those elements to be customized without the design changing.
You can ‘detach’ a Synced Pattern instance which will allow it to operate like an Unsynced Pattern, losing the ability to be updated across the site but opening the ability to customize it further.

Packaging Image Assets used in Patterns with your Theme
When building Theme Patterns you may be using image assets that will need to be included when distributing your theme. In the Pattern Builder Browser selecting ‘Configuration’ will bring you to a screen that gives you the option to ‘Import Images to Theme’. With this selected any time you save a Theme Pattern the images used in that pattern are downloaded to your Theme’s asset folder and referenced from there. Because referencing images in this way is dynamic a small amount of PHP is used in your pattern to reference those images.
Any block that uses images (such as the Cover, Image, Group, etc) works to import the image.
Since your use-case might be referencing images from a CDN or something this is an optional step (though it is enabled by default).
<!-- wp:image {"id":1309,"sizeSlug":"large","linkDestination":"none"} -->
<figure class="wp-block-image"><img src="<?php echo get_stylesheet_directory_uri() . '/assets/images/twenty_bellows_logo.png'; ?>" alt="" class="wp-image-1309"/></figure>
<!-- /wp:image -->

Localizing Pattern Content for Internationalization
Some themes (especially those made available for wide distribute) need to have their content localized so that it is available for international distribution.
From the Pattern Builder Browser select the ‘Configuration’ option and make sure the ‘Localize Patterns’ option is checked. When enabled, any Theme Pattern that is saved will localize the content in any of the blocks. Any block with text (including blocks that can only be customized via code such as the label of Query Pagination blocks) will be localized with a small amount of PHP code.
<blockquote class="wp-block-quote">
<!-- wp:paragraph -->
<p><?php echo wp_kses_post( 'This is a paragraph in a quote', 'simple-theme' ); ?></p>
<!-- /wp:paragraph -->
<!-- wp:heading -->
<h2 class="wp-block-heading"><?php echo wp_kses_post( 'And this is a heading in one', 'simple-theme' ); ?></h2>
<!-- /wp:heading -->
</blockquote>

Using ‘Synced Theme Patterns’ in Production
Pattern Builder is intended to be used as a Development Tool, not in production. It CAN be used in production, but a number of things should be considered when doing so.
Most importantly the tools allows for the direct editing of Theme Files. This might be exactly what you want! However you should be aware that if the theme is updated in your production environment those pattern file changes will be overwritten and lost.
A more useful tool might be the Synced Patterns for Themes plugin. This plugin allows Themes to ship Synced Patterns, but doesn’t empower users to CHANGE those patterns, only USE them. That way when you send an update of a Theme to that environment there will only be your Theme changes to worry about.
It IS in the roadmap for Pattern Builder to offer an option to users to change Theme Patterns in a Production setting and give options to manage conflicts and roll back changes. However that isn’t something that this tool yet offers.
A note on Block Markup of Theme Synced Patterns
Here’s a little technical detail that might be worth knowing.
Mentioned above ‘User Patterns’ are defined in block markup as <wp:block> blocks and ‘Theme Patterns’ are defined in block markup as <wp:pattern> blocks. However, since only User Patterns can offer ‘Synced’ capabilities the Pattern Builder converts all Theme Patterns to User Patterns behind the scenes. That means that in your Block Markup view you may see patterns referenced like this: <!– wp:block {“ref”:123} /–>
When any content is saved the Pattern Builder will automatically convert that markup to reference the theme pattern instead. <!– wp:pattern {“slug”:”my-theme/my-pattern”} /–> When that content is loaded into the editor it’s again converted to the <wp:block> version.
This means that the content (templates, patterns with nested patterns, etc) will all be referencing patterns in a way that won’t require solutions like Pattern Builder or Synced Patterns for Themes. The Themes will already be formatted in a way that is clean and portable.
Interested in Contributing?
The project is Open Source! Want to report a bug or have an idea to make the project better?