_get_block_templates_paths() – Finds all nested template part file paths in a theme’s directory.

You appear to be a bot. Output may be restricted

Description

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

Usage

$array = _get_block_templates_paths( $base_directory );

Parameters

$base_directory
( string ) required – The theme's file path.

Returns

array A list of paths to all template part files.

Source

File name: wordpress/wp-includes/block-template-utils.php
Lines:

1 to 11 of 11
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;
}
 

 View on GitHub View on Trac