Automattic\WooCommerce\Blocks\Templates
ProductCatalogTemplate::handle_get_post_metadata
Use the Product Catalog template for the Shop page without changing its saved template.
Метод класса: ProductCatalogTemplate{}
Хуков нет.
Возвращает
mixed.
Использование
$ProductCatalogTemplate = new ProductCatalogTemplate(); $ProductCatalogTemplate->handle_get_post_metadata( $value, $post_id, $meta_key, $single );
- $value(разное) (обязательный)
- Short-circuited metadata value, or null.
- $post_id(int) (обязательный)
- Post ID.
- $meta_key(строка) (обязательный)
- Metadata key.
- $single(true|false) (обязательный)
- Whether to return a single value.
Код ProductCatalogTemplate::handle_get_post_metadata() ProductCatalogTemplate::handle get post metadata WC 11.3.0
public function handle_get_post_metadata( $value, $post_id, $meta_key, $single ) {
if (
null === $value &&
'_wp_page_template' === $meta_key &&
wp_is_block_theme() &&
wc_get_page_id( 'shop' ) === $post_id
) {
return $single ? self::SLUG : array( self::SLUG );
}
return $value;
}