Table of Contents
The prepared structure is the starting point, not a suggestion. Project-specific changes should keep its philosophy, otherwise every later update of the design system turns into a merge. Each kind of change has one place it belongs.
Choosing the place
Go down this list and stop at the first step that does the job. Each step costs more than the one before it, in code, in maintenance and in what an update has to carry along.
| Step | Use it when | Lives in |
|---|---|---|
| Section or block style | the function stays the same and only the appearance changes | the theme, styles/ |
| Pattern | a section has a conceptual goal no existing pattern serves | the theme, patterns/ |
| Block variation | a core block has to behave differently | the Custom theme, block-variations/ |
| Block | core blocks cannot express the content | a plugin |
| Post type | the content is a type of its own, with its own fields and archive | a plugin |
| Theme function | the site has to behave differently, independent of any content | the theme, functions/ |
The dividing line between theme and plugin is the content. Whatever is stored in posts and pages, such as a block’s markup or a post type’s entries, must survive a change of theme, so it never lives in the theme.
Section and block styles
We use section and block styles when the function stays the same but the appearance should change. Both themes keep them as JSON files in styles/: boxes, sections, the eyebrow, and in Custom the infobox and list styles. The color palettes live one level deeper in styles/colors/; the numeric prefix of the filename sets their order in the Site Editor.
Which style to use where is described in the Foundations.
New patterns
A new pattern is added when it serves a new conceptual goal: a job on the page that no existing pattern does. A different look for the same job is no such goal. Another column count, a swapped image position or a new color is a style, a setting in the editor or a change in the project, not a new pattern.
- New family: the section does a job no family covers yet. It needs exactly one category, a Figma component set and a documentation entry.
- New variant: the family is right, but none of its variants fits the situation. What sets it apart is stated in its description, as a situation its siblings do not cover, never as a layout. A variant whose only difference from a sibling is its look is a candidate for removal, not an addition.
The rules for choosing a family, a variant and a category are in the Patterns guideline.
Template parts
A new template part is added only for global layout: something every page of a template carries, outside its content area. It lives in the theme’s parts/, gets its area under templateParts in theme.json, and takes its content from a pattern, so it can be translated. Sections that belong to a page are patterns; content that has to be identical on several pages is a synced pattern, which WordPress stores in the database and which therefore survives a change of theme. The rule for choosing is in the Patterns guideline.
Block variations
We use block variations when a core block has to behave differently: there is a standard block, and we adapt it to general or project-specific requirements. Typical cases are the Button block and the Query Loop block.
Block variations are part of the Custom theme and live in block-variations/, one PHP file per variation. related-posts.php is the prepared example: it adapts the Query Loop block so it only shows posts that share a category with the current post, and shows nothing when no other post matches. If more than the bare block variation is needed, it becomes a plugin.
Blocks
We write a block of our own only when core blocks cannot express the content: when it needs structured fields, or output that is computed on the server. Content that core blocks can hold, a heading with a link for example, is a pattern or plain text in the project, not a block.
A block always ships in a plugin, never in the theme. Its markup is stored in the content, and in the theme it would turn into an unsupported block the moment the theme changes.
- PHP-only block: when fields in the block settings are enough. It is registered in PHP with
autoRegister, needs no build step, and the editor shows a server-rendered preview. - Block with a build: when it needs inner blocks, editing on the canvas or the Interactivity API. It is written with
block.jsonand compiled with the official WordPress build tools. The blocks of WP Design System – Map are the example.
Custom post types
Custom post types are registered in PHP inside a plugin, never in the theme, and not through Advanced Custom Fields with a JSON sync into the theme.
A post type is one self-contained package: registration, taxonomies, templates, patterns and the styling they need ship together in a single plugin. For recurring use cases we maintain prepared plugins.
Plugins
A plugin carries what has to outlive the theme, blocks and post types, and features that stand on their own, combine front end and back end and are only needed in some projects, such as filters.
- One plugin per feature. It brings everything the feature needs: its blocks, its settings, its post types.
- Patterns stay in the theme. Patterns built on a plugin’s blocks live in the Custom theme, which offers them only while the plugin is active.
- Every plugin works on its own. Plugins may work together, but none may depend on another.
- Every plugin offers its functions as abilities. It registers them in the WordPress Abilities API, so AI agents can read and configure its blocks from a prompt, with the same permissions an editor needs. This is mandatory for every plugin.
- The name says what it is about, not how it is built:
wp-design-system-followed by the subject, such aswp-design-system-map. A plugin that later gains a post type or a second block keeps its name.
The prepared plugins ship next to the themes, each as its own ZIP with its own version number. What each one adds and how to set it up is described under Plugins.
Theme functions
Both themes keep their PHP in functions/. In Core every file in that folder is loaded automatically. In Custom, functions.php loads Core’s files first and then Custom’s in the fixed order of its list. Add a new file to that list; otherwise it loads early, together with Core’s.
A theme function changes how the site behaves independent of any content: the login screen, the dashboard, security, editor settings. Every function carries the kb_ prefix. What each file does is listed in the Feature Overview, which is generated from the code.