wpseek.com
A WordPress-centric search engine for devs and theme authors



_get_block_templates_paths › WordPress Function

Since5.9.0
Deprecatedn/a
_get_block_templates_paths ( $base_directory )
Access:
  • private
Parameters:
  • (string) $base_directory The theme's file path.
    Required: Yes
Returns:
  • (array) $path_list A list of paths to all template part files.
Defined at:
Codex:

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



Source

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