Skip to content

Template-parts make no sense when they are not independent of its template. #41433

@Humanify-nl

Description

@Humanify-nl

After months of trying to find a workflow that makes sense, today we decided to stop using template-parts altogether, because it makes building themes more work, instead of less work.

Which should be the whole point of using template-parts, making it fast and easy to create pages out of parts. They are not independent of their templates, and not interchangeable without a lot of manual actions (e.g. setting html-element for each and every template). Moreso, using patterns is easier and straigtforward.

Problem

It is a constant fight with setting (and keeping) the html-elements of template-parts, and the editor is not helping.

  1. The i.e. 'footer' html element has to be manually set when having placed a footer (this makes no sense!).
  2. We can not specify the html-element for the template-part itself in the editor.
  3. Instead, we have to add the element for each part in the template where the part is assigned, for each template it is used in (there goes independency out of window).
  4. Exporting the theme ignores all the elements that are set and all we get is blank div's.

What is the actual problem?

Template-parts should be interchangeable, and totally independent of the template it is placed in. If not, patterns do exactly the same and work seamlessly, and are better designed.

Solution(s)

  • Make it possible to set html-element in the template-part itself (in editor template-parts screen).
  • Make html-element available per template-part in theme.json
  • Remove the dependency on settings in the template where a part is assigned, and save it instead to the template-part.
  • Make redundant actions (such as setting 'footer' tag for a footer part) unavailable, to smooth out the workflow.

Crazy idea:

  • Deprecate template-parts and add to patterns the ability to wrap them inside an html-element. Which can be easily added in theme.json or via the php file headers.

Metadata

Metadata

Assignees

No one assigned

    Labels

    [Block] Template PartAffects the Template Parts Block[Feature] Site EditorRelated to the overarching Site Editor (formerly "full site editing")[Type] EnhancementA suggestion for improvement.

    Type

    No type
    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions