WP_Theme::get_files( mixed $type = null, int $depth, bool $search_parent = false )

Return files in the theme’s directory.


Parameters

$type

(Optional) Array of extensions to return. Defaults to all files (null).

Default value: null

$depth

(Optional) How deep to search for files. Defaults to a flat scan (0 depth). -1 depth is infinite.

$search_parent

(Optional) Whether to return parent files. Defaults to false.

Default value: false


Return

(array) Array of files, keyed by the path to the file relative to the theme's directory, with the values being absolute paths.


Source

File: wp-includes/class-wp-theme.php

	public function get_files( $type = null, $depth = 0, $search_parent = false ) {
		$files = (array) self::scandir( $this->get_stylesheet_directory(), $type, $depth );

		if ( $search_parent && $this->parent() ) {
			$files += (array) self::scandir( $this->get_template_directory(), $type, $depth );
		}

		return $files;
	}


Changelog

Changelog
Version Description
WP-3.4.0 Introduced.