我遇到了一个大问题,我在我的网站上使用了这段代码 - fetch products if image is found in woocommerce?
<?php
$args = array(
'post_type' => 'product',
'stock' => 1,
'posts_per_page' => 9,
'orderby' =>'date',
'orderby' => 'rand',
'meta_query'=>array(
array(
'key'=>'_thumbnail_id',
'compare' => 'EXISTS'
)
)
);
$loop = new WP_Query( $args );
while ($loop->have_posts()) : $loop->the_post();
echo get_the_post_thumbnail($loop->post->ID, 'shop_catalog');
endwhile;
?>
但我无法过滤产品,我是否必须按顺序放置一些变量? 我不能把它按顺序排列