[wp-trac] [WordPress Trac] #54829: Allow classic themes to be optionally block themes if 'templates' and 'parts' folders exists

WordPress Trac noreply at wordpress.org
Sun Jan 16 03:12:20 UTC 2022


#54829: Allow classic themes to be optionally block themes if 'templates' and
'parts' folders exists
----------------------------------------------------+---------------------
 Reporter:  exstheme                                |       Owner:  (none)
     Type:  enhancement                             |      Status:  new
 Priority:  normal                                  |   Milestone:  6.0
Component:  Themes                                  |     Version:  trunk
 Severity:  normal                                  |  Resolution:
 Keywords:  has-patch has-unit-tests needs-testing  |     Focuses:
----------------------------------------------------+---------------------
Changes (by costdev):

 * keywords:  reporter-feedback has-patch has-unit-tests => has-patch has-
     unit-tests needs-testing
 * milestone:  Awaiting Review => 6.0


Comment:

 This makes sense to me. Not only does it allow for a wider range of
 conditions by extenders, but it also allows Core to make adjustments when
 directly modifying `WP_Theme::is_block_theme()` may not be appropriate,
 which may also include the test suite.

 @exstheme, I've added a PR to implement an `'is_block_theme'` filter.

 Please apply the changes in the PR and let me know if this works for you
 when using these callbacks:

 {{{#!php
 <?php

 // Option 1 - Force disable block theme functionality.
 add_filter( 'is_block_theme', '__return_false' );

 // Option 2 - Force enable block theme functionality.
 add_filter( 'is_block_theme', '__return_true' );
 }}}

 For review of the ticket and the PR, I'm pinging @noisysocks and @poena
 regarding the impact on block themes and @hellofromTonya regarding the
 unit tests given that she wrote the `is_block_theme()` tests and may have
 some insight to better test the filter in context.

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


More information about the wp-trac mailing list