Skip to content

Revise folder structure on themes made with blocks #36548

@mtias

Description

@mtias

We are on the cusp of establishing a new organization of theme files that can help creators orient themselves. This is a relatively minor issue, all things considered, but it can still have fundamental implications for the experience of building themes and its perceived simplicity, so we should act now in accordance.

(There is a related discussion in #34550 that also raises some good points.)

I'm suggesting:

  • Rename /block- folders to their simpler and more direct /templates and /parts (or maybe /sections for the latter, though we can discuss this one at a later stage). Keep compatibility with “block-” prefixes as aliases. If there's a really strong desire to preserve /block- at least rename /block-template-parts to /block-parts.
  • Consider in the future we'll likely have a /styles folder to allow different theme.json files, both as variations and as context providers (mapping to theme hierarchy).
  • Allow the existence of a /patterns folder that automatically loads pattern files contained inside.
    • Avoid manual registration. Patterns should be a breeze for themes to author.
    • These patterns become available for the theme to use directly in wp:pattern.
    • Categories and metadata is managed in file header.
  • Ensure themes can include and load PHP templates as expected alongside block templates when an HTML one cannot be found. This is important to allow the presence of specific dynamic templates for given routes (i.e. a specific custom post type archive, etc). This should be properly documented as a faculty of the design.

Metadata

Metadata

Assignees

Labels

FrameworkIssues related to broader framework topics, especially as it relates to javascript[Feature] ThemesQuestions or issues with incorporating or styling blocks in a theme.

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions