I have a simple following logic:
$args = array( 'post_type' => array('product'), 'product_cat' => 280, 'posts_per_page' => 3 ); $category_posts = new WP_Query( $args ); if($category_posts->have_posts()): $result = '<div class="three-products">'; while($category_posts->have_posts()): the_post(); $result .= '<div class="one-product">'.the_post_thumbnail( 'thumbnail' ).'</div>'; endwhile; $result .= '</div>'; wp_reset_postdata(); return $result; else: _e( 'There were no products matching your criteria.' ); endif;
I am sure that there are products in category 280, however have_posts always returns false.
If I comment that line out, it seems to end in infinite loop and does not load page at all.
Any help or guidance is much appreciated.