For a particular category I needed to merge in another custom post type. Now I would like to resort the query based on a custom field. Is this possible?
Below is the way I’ve merged the queries.
if (in_category( 'Events' ) && is_archive()) {
global $wp_query;
$args = array (
'post_type' => 'custom_post_type'
);
$second_query = new WP_Query( $args );
$wp_query->posts = array_merge( $wp_query->posts, $second_query->posts );
$wp_query->post_count = $wp_query->post_count + $second_query->post_count;
}
Thanks!