Wordpress 如何在一页电子商务中展示销售中的产品
是否可以创建一个页面,在那里显示所有正在销售的产品 我尝试这个代码,但得到我所有的产品有销售或没有Wordpress 如何在一页电子商务中展示销售中的产品,wordpress,woocommerce,Wordpress,Woocommerce,是否可以创建一个页面,在那里显示所有正在销售的产品 我尝试这个代码,但得到我所有的产品有销售或没有 $args = array( 'post_type'=>'product', 'order' => 'ASC', 'showposts' =>$pageSize, 'paged' => $paged, 'meta_query' => array( array(
$args = array(
'post_type'=>'product',
'order' => 'ASC',
'showposts' =>$pageSize,
'paged' => $paged,
'meta_query' => array(
array(
'key' => '_stock_status',
'value' => 'instock',
'compare' => '='
),
array(
'relation' => 'OR',
array(// Simple products type
'key' => '_sale_price',
'value' => 0,
'compare' => '>',
'type' => 'numeric'
),
array(// Variable products type
'key' => '_min_variation_sale_price',
'value' => 0,
'compare' => '>',
'type' => 'numeric'
)
)
)
);
默认情况下,woo commerce在下面的简短代码中有一个选项:-
[products limit="4" columns="4" orderby="popularity" class="quick-sale" on_sale="true" ]