I’m trying to sort posts by two fields on the main page. One field is a true/false field to indicate that the post should be displayed on the main page, the second field is a numeric field, I want to set the order in which the posts will be displayed. but, in the end, I get the loop of posts in the wrong order and not all of them.
Here is code
<?php
$args = array(
'post_type' => 'product',
'posts_per_page' => '4',
'post_status' => 'publish',
'meta_key' => 'hot',
'meta_value' => true,
'meta_query' => array(
'meta_key' => 'featured',
'orderby' => 'meta_value',
'order' => 'ASC',
),
);
$products = new WP_Query($args);
$max_pages = $products->max_num_pages;
if($products->have_posts()) : ?>