Automattic\WooCommerce\Blocks
BlockTemplatesController::add_archive_product_to_eligible_for_fallback_templates()
Adds the archive-product template to the taxonomy-product_cat, taxonomy-product_tag, taxonomy-attribute templates to be able to fall back to it.
Метод класса: BlockTemplatesController{}
Хуков нет.
Возвращает
null
. Ничего (null).
Использование
$BlockTemplatesController = new BlockTemplatesController(); $BlockTemplatesController->add_archive_product_to_eligible_for_fallback_templates( $template_hierarchy );
- $template_hierarchy(массив) (обязательный)
- A list of template candidates, in descending order of priority.
Код BlockTemplatesController::add_archive_product_to_eligible_for_fallback_templates() BlockTemplatesController::add archive product to eligible for fallback templates WC 8.7.0
public function add_archive_product_to_eligible_for_fallback_templates( $template_hierarchy ) { $template_slugs = array_map( '_strip_template_file_suffix', $template_hierarchy ); $templates_eligible_for_fallback = array_filter( $template_slugs, array( BlockTemplateUtils::class, 'template_is_eligible_for_product_archive_fallback' ) ); if ( count( $templates_eligible_for_fallback ) > 0 ) { $template_hierarchy[] = 'archive-product'; } return $template_hierarchy; }