WP_Theme::get_block_template_folders()
Returns the folder names of the block template directories.
Метод класса: WP_Theme{}
Хуков нет.
Возвращает
Строку[]
. Folder names used by block themes.
Использование
$WP_Theme = new WP_Theme(); $WP_Theme->get_block_template_folders();
Список изменений
С версии 6.4.0 | Введена. |
Код WP_Theme::get_block_template_folders() WP Theme::get block template folders WP 6.6.2
public function get_block_template_folders() { // Return set/cached value if available. if ( isset( $this->block_template_folders ) ) { return $this->block_template_folders; } $this->block_template_folders = $this->default_template_folders; $stylesheet_directory = $this->get_stylesheet_directory(); // If the theme uses deprecated block template folders. if ( file_exists( $stylesheet_directory . '/block-templates' ) || file_exists( $stylesheet_directory . '/block-template-parts' ) ) { $this->block_template_folders = array( 'wp_template' => 'block-templates', 'wp_template_part' => 'block-template-parts', ); } return $this->block_template_folders; }