WP_Theme::get_files
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 );
- $type(string[]|строка)
- Array of extensions to find, string of a single extension, or null for all extensions.
По умолчанию:null - $depth(int)
- How deep to search for files.
-1 depth is infinite.
По умолчанию:flat scan (0 depth) - $search_parent(true|false)
- Whether to return parent files.
По умолчанию:false
Список изменений
| С версии 3.4.0 | Введена. |
Код WP_Theme::get_files() WP Theme::get files WP 6.9.1
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 );
}