'{content}' => $block_content, ) ); } /* * Use this function to restore the context of the template tags * from a secondary query loop back to the main query loop. * Since we use two custom loops, it's safest to always restore. */ wp_reset_postdata(); return sprintf( '', $wrapper_attributes, $content ); } /** * Determines whether a block list contains a block that uses the featured image. * * @param WP_Block_List $inner_blocks Inner block instance. * * @return bool Whether the block list contains a block that uses the featured image. */ protected function block_core_post_template_uses_featured_image( $inner_blocks ) { foreach ( $inner_blocks as $block ) { if ( 'core/post-featured-image' === $block->name ) { return true; } if ( 'core/cover' === $block->name && ! empty( $block->attributes['useFeaturedImage'] ) ) { return true; } if ( $block->inner_blocks && block_core_post_template_uses_featured_image( $block->inner_blocks ) ) { return true; } } return false; } /** * Product Template renders inner blocks manually so we need to skip default * rendering routine for its inner blocks * * @param array $settings Array of determined settings for registering a block type. * @param array $metadata Metadata provided for registering a block type. * @return array */ public function add_block_type_metadata_settings( $settings, $metadata ) { if ( ! empty( $metadata['name'] ) && 'woocommerce/product-template' === $metadata['name'] ) { $settings['skip_inner_blocks'] = true; } return $settings; } }
Fatal error: Uncaught Error: Class "Automattic\WooCommerce\Blocks\BlockTypes\ProductTemplate" not found in /htdocs/wp-content/plugins/woocommerce/src/Blocks/BlockTypesController.php:153 Stack trace: #0 /htdocs/wp-includes/class-wp-hook.php(324): Automattic\WooCommerce\Blocks\BlockTypesController->register_blocks('') #1 /htdocs/wp-includes/class-wp-hook.php(348): WP_Hook->apply_filters(NULL, Array) #2 /htdocs/wp-includes/plugin.php(517): WP_Hook->do_action(Array) #3 /htdocs/wp-settings.php(700): do_action('init') #4 /htdocs/wp-config.php(98): require_once('/htdocs/wp-sett...') #5 /htdocs/wp-load.php(50): require_once('/htdocs/wp-conf...') #6 /htdocs/wp-blog-header.php(13): require_once('/htdocs/wp-load...') #7 /htdocs/index.php(17): require('/htdocs/wp-blog...') #8 {main} thrown in /htdocs/wp-content/plugins/woocommerce/src/Blocks/BlockTypesController.php on line 153