WP_Theme::get_files()publicWP 3.4.0

Returns files in the theme's directory.

Метод класса: WP_Theme{}

Хуков нет.


Строку[]. Array of files, keyed by the path to the file relative to the theme's directory, with the values being absolute paths.


$WP_Theme = new WP_Theme();
$WP_Theme->get_files( $type, $depth, $search_parent );
Array of extensions to find, string of a single extension, or null for all extensions.
По умолчанию: null
How deep to search for files.
-1 depth is infinite.
По умолчанию: flat scan (0 depth)
Whether to return parent files.
По умолчанию: false

Список изменений

С версии 3.4.0 Введена.

Код WP_Theme::get_files() WP 6.4.3

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