[wp-trac] [WordPress Trac] #53176: Block Editor: Backport the FSE infrastructure required to make the template editor work for classic themes.

WordPress Trac noreply at wordpress.org
Wed May 19 13:33:09 UTC 2021


#53176: Block Editor: Backport the FSE infrastructure required to make the template
editor work for classic themes.
----------------------------+---------------------
 Reporter:  youknowriad     |       Owner:  (none)
     Type:  task (blessed)  |      Status:  new
 Priority:  normal          |   Milestone:  5.8
Component:  Editor          |     Version:
 Severity:  normal          |  Resolution:
 Keywords:                  |     Focuses:
----------------------------+---------------------

Comment (by Bernhard Reiter):

 Some more thoughts:

 The `wp_template` post objects are clearly the the major challenge. The
 rest of the logic would scale fairly well to block templates:

 - `locate_template()` seems suffix agnostic -- it could probably find
 `.html` files (even if located in a `block-templates` subfolder) as easily
 as `.php` ones.
 - We could change either the `get_{type}_template` methods, or use the
 `type_template_hiearchy` filter, to add the `block-templates/*.html`
 counterpart for each PHP template. E.g.


 {{{#!php
 array(
         'page-slug.php',
         'page-123.php',
         'page.php',
 );
 }}}

 becomes

 {{{#!php
 array(
         'block-templates/page-slug.html',
         'page-slug.php',
         'block-templates/page-123.html',
         'page-123.php',
         'block-templates/page.html',
         'page.php',
 );
 }}}

 The duplication might look a bit heavy-handed, but it's at least
 representative of what the `get_{type}_template` function (or the
 `type_template_hiearchy`) are supposed to do, which is nominating template
 file candidates.

-- 
Ticket URL: <https://core.trac.wordpress.org/ticket/53176#comment:3>
WordPress Trac <https://core.trac.wordpress.org/>
WordPress publishing platform


More information about the wp-trac mailing list