Skip to content

Instantly share code, notes, and snippets.

@illucent
Created March 7, 2014 13:15
Show Gist options
  • Select an option

  • Save illucent/9411279 to your computer and use it in GitHub Desktop.

Select an option

Save illucent/9411279 to your computer and use it in GitHub Desktop.
array merge
photos_query = new WP_Query( $photos );
$quotes_query = new WP_Query( $quotes );
$result = new WP_Query();
// start putting the contents in the new object
$result->posts = array_merge( $photos_query->posts, $quotes_query->posts );
// here you might wanna apply some sort of sorting on $result->posts
// we also need to set post count correctly so as to enable the looping
$result->post_count = count( $result->posts );
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment