Skip to content
This repository has been archived by the owner on Feb 23, 2024. It is now read-only.

Fix WC templates loading for WP 5.9 without Gutenberg plugin #5335

Merged
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
11 changes: 9 additions & 2 deletions src/BlockTemplatesController.php
Original file line number Diff line number Diff line change
Expand Up @@ -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;
}

Expand Down Expand Up @@ -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;
}

Expand Down