Automattic\WooCommerce\Blocks\Utils
BlockTemplateUtils::supports_block_templates
Checks to see if they are using a compatible version of WP, or if not they have a compatible version of the Gutenberg plugin installed.
Method of the class: BlockTemplateUtils{}
No Hooks.
Returns
true|false.
Usage
$result = BlockTemplateUtils::supports_block_templates( $template_type );
- $template_type(string)
- Template type:
wp_templateorwp_template_part.
Default:wp_template
BlockTemplateUtils::supports_block_templates() BlockTemplateUtils::supports block templates code WC 11.0.1
public static function supports_block_templates( $template_type = 'wp_template' ) {
if ( 'wp_template_part' === $template_type && ( wp_is_block_theme() || current_theme_supports( 'block-template-parts' ) ) ) {
return true;
} elseif ( 'wp_template' === $template_type && wp_is_block_theme() ) {
return true;
}
return false;
}