Make WordPress Core

Opened 2 years ago

Closed 2 years ago

Last modified 2 years ago

#54493 closed task (blessed) (fixed)

Block Themes: Update the theme folders to be templates and parts

Reported by: youknowriad's profile youknowriad Owned by: youknowriad's profile youknowriad
Milestone: 5.9 Priority: normal
Severity: normal Version:
Component: Themes Keywords: has-patch
Focuses: Cc:

Description (last modified by youknowriad)

This ticket is here to track the backport of implemented in

The idea is to use "templates" and "parts" as folders instead of "block-templates" and "block-template-parts" for block themes while retaining backward compatibility for the latter.

While there are already themes that use the previous folders here, we prefer to update the folders while the number of themes is small 20/30 early adopters to ensure consistency in theme folders for all FSE themes (we expect a far bigger number in the future).

Existing FSE themes will continue to work properly without any change, backward compatibility for the previous folders will be kept.

Delaying this change to 6.0 would be more impactful since more themes would exist at that point and plugins might start relying on the presence of the old folders.

Change History (8)

This ticket was mentioned in PR #1932 on WordPress/wordpress-develop by youknowriad.

2 years ago

  • Keywords has-patch added

Backport the theme folders change from the Gutenberg plugin.

Trac ticket:

ockham commented on PR #1932:

2 years ago

This LGTM. Unfortunately, I can't currently test manually (some issue with MySQL in my local dev setup, probably yet another collision with my GB dev setup 🙄 ).

Instead, I've tested these changes on top of #1920 (by running unit tests), and they're unfortunately failing 😕

There were 3 failures:

1) Block_Template_Test::test_child_theme_block_template_takes_precedence_over_equally_specific_parent_theme_php_template
Failed asserting that two strings are equal.
--- Expected
+++ Actual
@@ @@


2) Block_Template_Test::test_custom_page_block_template_takes_precedence_over_all_other_templates
Failed asserting that two strings are identical.
--- Expected
+++ Actual
@@ @@
+<p>Page Template</p>


Would it make sense to get #1920 in first for added confidence?

#4 @youknowriad
2 years ago

  • Description modified (diff)

#5 @youknowriad
2 years ago

  • Description modified (diff)

#6 @youknowriad
2 years ago

  • Owner set to youknowriad
  • Resolution set to fixed
  • Status changed from new to closed

In 52247:

Themes: Update the base folders for templates and template parts in block themes.

Block Themes should now use the following folders:

  • templates instead of block-templates
  • parts instead of block-template-parts

Existing themes and folders will continue to work without impact.

Props bernhard-reiter.
Fixes #54493.

#8 @youknowriad
2 years ago

Templates parts using the "parts" folder are still not working on the frontend but this will be fixed automatically in the next package update.

Note: See TracTickets for help on using tickets.