Make WordPress Core

Opened 6 days ago

Closed 4 days ago

Last modified 4 days ago

#54493 closed task (blessed) (fixed)

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

Reported by: youknowriad Owned by: 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 https://github.com/WordPress/gutenberg/issues/36548 implemented in https://github.com/WordPress/gutenberg/pull/36647

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.

6 days ago

  • Keywords has-patch added

Backport the theme folders change from the Gutenberg plugin.

Trac ticket: https://core.trac.wordpress.org/ticket/54493

#3 @prbot
6 days ago

ockham commented on PR #1932:

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
4 days ago

  • Description modified (diff)

#5 @youknowriad
4 days ago

  • Description modified (diff)

#6 @youknowriad
4 days 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
4 days 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.