From fc58c0fb9bbc0635f3e7b2ed5ffd2b72b50e6731 Mon Sep 17 00:00:00 2001 From: Tom Cafferkey Date: Wed, 8 Dec 2021 11:21:57 +0000 Subject: [PATCH] Update block theme conditionals in BlockTemplateController (#5335) --- src/BlockTemplatesController.php | 11 +++++++++-- 1 file changed, 9 insertions(+), 2 deletions(-) diff --git a/src/BlockTemplatesController.php b/src/BlockTemplatesController.php index cbfab6af177..0e47f2de912 100644 --- a/src/BlockTemplatesController.php +++ b/src/BlockTemplatesController.php @@ -153,7 +153,10 @@ public function get_single_block_template( $template, $id, $template_type ) { * @return array */ public function add_block_templates( $query_result, $query, $template_type ) { - if ( ! function_exists( 'gutenberg_supports_block_templates' ) || ! gutenberg_supports_block_templates() ) { + if ( + ( ! function_exists( 'wp_is_block_theme' ) || ! wp_is_block_theme() ) && + ( ! function_exists( 'gutenberg_supports_block_templates' ) || ! gutenberg_supports_block_templates() ) + ) { return $query_result; } @@ -406,7 +409,11 @@ public function block_template_is_available( $template_name, $template_type = 'w * Renders the default block template from Woo Blocks if no theme templates exist. */ public function render_block_template() { - if ( is_embed() || ! function_exists( 'gutenberg_supports_block_templates' ) || ! gutenberg_supports_block_templates() ) { + if ( + is_embed() || + ( ! function_exists( 'wp_is_block_theme' ) || ! wp_is_block_theme() ) && + ( ! function_exists( 'gutenberg_supports_block_templates' ) || ! gutenberg_supports_block_templates() ) + ) { return; }