Returns files in the theme’s directory.
Parameters
$type
string[]|stringoptional- Array of extensions to find, string of a single extension, or null for all extensions.
Default:
null
$depth
intoptional- How deep to search for files. Defaults to a flat scan (0 depth).
-1 depth is infinite. $search_parent
booloptional- Whether to return parent files.
Default:
false
Source
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 array_filter( $files );
}
Changelog
Version | Description |
---|---|
3.4.0 | Introduced. |
User Contributed Notes
You must log in before being able to contribute a note or feedback.