Automattic\WooCommerce\Blocks\Templates
AbstractTemplateCompatibility::current_template_has_legacy_template_block
Check if the current template has a legacy template block.
Метод класса: AbstractTemplateCompatibility{}
Хуков нет.
Возвращает
true|false. True if the current template has a legacy template block, false otherwise.
Использование
$AbstractTemplateCompatibility = new AbstractTemplateCompatibility(); $AbstractTemplateCompatibility->current_template_has_legacy_template_block();
Код AbstractTemplateCompatibility::current_template_has_legacy_template_block() AbstractTemplateCompatibility::current template has legacy template block WC 11.0.1
public function current_template_has_legacy_template_block() {
global $_wp_current_template_id;
if ( empty( $_wp_current_template_id ) ) {
return false;
}
$current_template = get_block_template( $_wp_current_template_id, 'wp_template' );
if ( isset( $current_template ) && BlockTemplateUtils::template_has_legacy_template_block( $current_template ) ) {
return true;
}
return false;
}