Sorry for my bad english.
I have a big problem, I used this code in my website - 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;
?>
But I can't filter the products, have some variable to I put in orderby? I can't put this in order
Aucun commentaire:
Enregistrer un commentaire