Randomly sort part of already sorted query

I’m not entirely sure how to word my question, but I’ll give it a go.

Basically, what I’m wanting to do is order a group of posts by a custom field. I have a True/False custom field, created using the ACF plugin, which is displayed on a certain custom post type.

Right now, I’ve set up a query to firstly display posts with the True/False statement set to true, and then to display the posts with the statement set to false. This is working well.

What I want to do, however, is take the posts with the true statement and randomly change their order. All while keeping the current order or True first and then False in place.

Here is my current query.

                $paged = ( get_query_var( 'paged' ) ) ? get_query_var( 'paged' ) : 1;
                // the query
                $wpb_all_query = new WP_Query(array('post_type'=>'businesses', 'post_status'=>'publish', 'category_name'=>basename(get_permalink()), 'meta_key'=>'featured', 'orderby'=>'meta_value','order'=>'DESC', 'posts_per_page'=>20, 'paged' => $paged)); ?>

                    <?php if ( $wpb_all_query->have_posts() ) : ?>
                    <!-- the loop -->
                    <?php while ( $wpb_all_query->have_posts() ) : $wpb_all_query->the_post(); ?>

Go to Source
Author: Timothy Davis