_get_block_templates_paths

函数


_get_block_templates_paths ( $base_directory )
Access
Private
参数
  • (string)
    $base_directory
    The theme’s file path.
    Required:
返回值
  • (array) A list of paths to all template part files.
定义位置
  • wp-includes/block-template-utils.php
    , line 232
引入
5.9.0
弃用

Finds all nested template part file paths in a theme’s directory.

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;
}