WC_Brands::template_already_has_brand_block
Check if the template already contains a product brand block.
Method of the class: WC_Brands{}
No Hooks.
Returns
true|false. True if template contains a brand block.
Usage
// private - for code of main (parent) class only $result = $this->template_already_has_brand_block( $template );
- $template(WP_Block_Template) (required)
- The template object.
WC_Brands::template_already_has_brand_block() WC Brands::template already has brand block code WC 10.4.3
private function template_already_has_brand_block( $template ) {
if ( ! $template || empty( $template->content ) ) {
return false;
}
return strpos( $template->content, '<!-- wp:post-terms {"term":"product_brand"' ) !== false;
}