mirror of
git://develop.git.wordpress.org/
synced 2025-03-20 12:00:03 +01:00
Themes: Allow pattern files to be organized into sub-folders.
This allows theme pattern files located in a theme's `/patterns/` directory to be organized into sub-folders and will automatically be located by `WP_Theme::get_block_patterns()` method. Props juanfra, joemcgill, poena, flixos90. Fixes #62378. git-svn-id: https://develop.svn.wordpress.org/trunk@59872 602fd350-edb4-49c9-b593-d223f7449a82
This commit is contained in:
parent
8c7fe3c809
commit
cf198e8fc5
@ -1848,7 +1848,7 @@ final class WP_Theme implements ArrayAccess {
|
||||
$this->delete_pattern_cache();
|
||||
}
|
||||
|
||||
$dirpath = $this->get_stylesheet_directory() . '/patterns/';
|
||||
$dirpath = $this->get_stylesheet_directory() . '/patterns';
|
||||
$pattern_data = array();
|
||||
|
||||
if ( ! file_exists( $dirpath ) ) {
|
||||
@ -1857,7 +1857,11 @@ final class WP_Theme implements ArrayAccess {
|
||||
}
|
||||
return $pattern_data;
|
||||
}
|
||||
$files = glob( $dirpath . '*.php' );
|
||||
|
||||
$files = (array) self::scandir( $dirpath, 'php', -1 );
|
||||
|
||||
$dirpath = trailingslashit( $dirpath );
|
||||
|
||||
if ( ! $files ) {
|
||||
if ( $can_use_cached ) {
|
||||
$this->set_pattern_cache( $pattern_data );
|
||||
|
Loading…
x
Reference in New Issue
Block a user