_get_block_templates_paths()
Finds all nested template part file paths in a theme's directory.
Эта функция считается внутренней для использования самим ядром. Не рекомендуется использовать эту функцию в своем коде.
Хуков нет.
Возвращает
Массив
. A list of paths to all template part files.
Использование
_get_block_templates_paths( $base_directory );
- $base_directory(строка) (обязательный)
- The theme's file path.
Список изменений
С версии 5.9.0 | Введена. |
Код _get_block_templates_paths() get block templates paths WP 6.1.1
function _get_block_templates_paths( $base_directory ) { $path_list = array(); if ( file_exists( $base_directory ) ) { $nested_files = new RecursiveIteratorIterator( new RecursiveDirectoryIterator( $base_directory ) ); $nested_html_files = new RegexIterator( $nested_files, '/^.+\.html$/i', RecursiveRegexIterator::GET_MATCH ); foreach ( $nested_html_files as $path => $file ) { $path_list[] = $path; } } return $path_list; }