WC_Template_Loader::taxonomy_has_block_template
Checks whether a block template for a given taxonomy exists.
Note: This checks both the templates and block-templates directories as both conventions should be supported.
Method of the class: WC_Template_Loader{}
No Hooks.
Returns
true|false.
Usage
$result = WC_Template_Loader::taxonomy_has_block_template( $taxonomy ): bool;
- $taxonomy(object) (required)
- Object taxonomy to check.
WC_Template_Loader::taxonomy_has_block_template() WC Template Loader::taxonomy has block template code WC 10.8.1
private static function taxonomy_has_block_template( $taxonomy ): bool {
if ( taxonomy_is_product_attribute( $taxonomy->taxonomy ) ) {
$template_name = 'taxonomy-product_attribute';
} else {
$template_name = 'taxonomy-' . $taxonomy->taxonomy;
}
return self::has_block_template( $template_name );
}