37 lines
821 B
PHP
37 lines
821 B
PHP
<?php
|
|
/**
|
|
* Display the Hand-picked Products block in the post content.
|
|
* NOTE: DO NOT edit this file in WooCommerce core, this is generated from woocommerce-gutenberg-products-block.
|
|
*
|
|
* @package WooCommerce\Blocks
|
|
* @version 2.1.0
|
|
*/
|
|
|
|
if ( ! defined( 'ABSPATH' ) ) {
|
|
exit;
|
|
}
|
|
|
|
/**
|
|
* Handler for getting Hand-picked Products for display.
|
|
*/
|
|
class WGPB_Block_Handpicked_Products extends WGPB_Block_Grid_Base {
|
|
/**
|
|
* Block name.
|
|
*
|
|
* @var string
|
|
*/
|
|
protected $block_name = 'handpicked-products';
|
|
|
|
/**
|
|
* Set args specific to this block
|
|
*
|
|
* @param array $query_args Query args.
|
|
*/
|
|
protected function set_block_query_args( &$query_args ) {
|
|
$ids = array_map( 'absint', $this->attributes['products'] );
|
|
|
|
$query_args['post__in'] = $ids;
|
|
$query_args['posts_per_page'] = count( $ids );
|
|
}
|
|
}
|