Am Afraid that you have to go with Direct MYSQL
or you can run two WP_Query()
and then combine them, sort them or sort them with WP_Query()
then combine them.
Here is an example
$args = array(
'post_type' => array( 'staff-updates', 'coreteam',
'developing-updates', 'vacancies', 'recognition', 'page' ),
'orderby' => 'modified',
'posts_per_page' => '10',
'order' => 'DESC',
);
$the_query_modified = new WP_Query( $args );
$args = array(
'post_type' => 'employees',
'orderby' => 'date', //default to post_date
'posts_per_page' => '10',
'order' => 'DESC',
);
$the_query_published = new WP_Query( $args );
$combined = new WP_Query();
//combining two to one
$combined->posts = array_merge( $the_query_modified->posts, $the_query_published->posts );
Now $combined->posts
will have both. Then do whatever you want. $combined
might miss few details since it is not direct constructed. In that case you just manipuldate with two queryies( $the_query_modified
,$the_query_published
) directly or go for SQL