WP_Theme::is_block_theme()
Returns whether this theme is a block-based theme or not.
Метод класса: WP_Theme{}
Хуков нет.
Возвращает
true|false
.
Использование
$WP_Theme = new WP_Theme(); $WP_Theme->is_block_theme();
Список изменений
С версии 5.9.0 | Введена. |
Код WP_Theme::is_block_theme() WP Theme::is block theme WP 6.1.1
public function is_block_theme() { $paths_to_index_block_template = array( $this->get_file_path( '/block-templates/index.html' ), $this->get_file_path( '/templates/index.html' ), ); foreach ( $paths_to_index_block_template as $path_to_index_block_template ) { if ( is_file( $path_to_index_block_template ) && is_readable( $path_to_index_block_template ) ) { return true; } } return false; }