I have some custom post types called "products", all with different published dates. Below is my loop that grabs these posts:
$args = array(
'post_type' => 'product',
'post_status' => 'publish',
'posts_per_page' => $numposts,
'orderby' => 'date',
'order' => 'DESC',
'product-category' => $cat,
'paged' => $paged,
'author' => $author,
);
$loop = new WP_Query( $args );
if (!$loop->have_posts()){
return 'No products available.';
}
I have my orderby set to date desc, but it's not taking effect on the frontend (they're just randomly ordered). What's also odd is that in the backend, if I look at my custom posts and sort by the "date" column, they don't sort there either. It's like it can't read the published date even though the date is showing on each post. Thoughts?