From 7fbe1321d0111c041f9c3f63b308a7c2e661d27f Mon Sep 17 00:00:00 2001 From: Tom Cafferkey Date: Mon, 20 Dec 2021 14:36:26 +0000 Subject: [PATCH] Check for woocommerce as the theme before rendering with a more user friendly plugin name (#5420) --- src/Utils/BlockTemplateUtils.php | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/src/Utils/BlockTemplateUtils.php b/src/Utils/BlockTemplateUtils.php index 6e592a98269..dbfa5c20976 100644 --- a/src/Utils/BlockTemplateUtils.php +++ b/src/Utils/BlockTemplateUtils.php @@ -98,7 +98,7 @@ public static function gutenberg_build_template_result_from_post( $post ) { $template = new \WP_Block_Template(); $template->wp_id = $post->ID; $template->id = $theme . '//' . $post->post_name; - $template->theme = $theme; + $template->theme = 'woocommerce' === $theme ? 'WooCommerce' : $theme; $template->content = $post->post_content; $template->slug = $post->post_name; $template->source = 'custom'; @@ -109,6 +109,7 @@ public static function gutenberg_build_template_result_from_post( $post ) { $template->has_theme_file = $has_theme_file; $template->is_custom = true; $template->post_types = array(); // Don't appear in any Edit Post template selector dropdown. + if ( 'wp_template_part' === $post->post_type ) { $type_terms = get_the_terms( $post, 'wp_template_part_area' ); if ( ! is_wp_error( $type_terms ) && false !== $type_terms ) {