Automattic\WooCommerce\Blocks\Templates
ProductSearchResultsTemplate::update_search_template_hierarchy
When the search is for products and a block theme is active, render the Product Search Template.
Метод класса: ProductSearchResultsTemplate{}
Хуков нет.
Возвращает
null. Ничего (null).
Использование
$ProductSearchResultsTemplate = new ProductSearchResultsTemplate(); $ProductSearchResultsTemplate->update_search_template_hierarchy( $templates );
- $templates(массив) (обязательный)
- Templates that match the search hierarchy.
Код ProductSearchResultsTemplate::update_search_template_hierarchy() ProductSearchResultsTemplate::update search template hierarchy WC 10.7.0
public function update_search_template_hierarchy( $templates ) {
if ( ( is_search() && is_post_type_archive( 'product' ) ) && wp_is_block_theme() ) {
array_unshift( $templates, self::SLUG );
}
return $templates;
}