I basically want my post order first on upcoming releases and if there are non or no more I want to order them by latest releases. I would also like the upcoming book releases to be ordered by nearest to date (the book being released tomorrow first post and the book being released next week the second post etc.) If there are no more upcoming releases I would like it to show the latest releases so book 1 tomorrow’s release, book 2 next weeks release book 3 last weeks release). Right now in my query, I get the upcoming releases but then no more posts show up. The release date is coming from a custom field that is inside a repeater field. Here is what I got so far.

$arg_post = array(
                    'post_type' => 'bocker',
                    'posts_per_page' => 6,
                    'meta_query' => array(
                        'relation' => 'OR',
                        'release_date' => array(
                            'meta_key' => 'editions_release_date',
                            'value' => date('Y-m-d'),
                            'type' => 'date',
                            'compare' => '>',
                            'order' => 'ASC'
                        'all_post' => array(
                            'meta_key' => 'editions_release_date',
                            'value' => date('Y-m-d'),
                            'type' => 'date',
                    $bockerpost = new WP_Query($arg_post);
  • This will require your own PHP to sort and (I believe) two queries.
    – jdm2112
    Oct 20 at 18:07

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Browse other questions tagged or ask your own question.