Support » Fixing WordPress » Combine Queries – Randomise Results

  • Hi all, i’m at the very end of this little puzzle, but stuck at the last bit.

    I have successfully combined my queries using the following code:

    <?php $blogposts = get_posts(array(
       				'post_type' => 'post',
       				'posts_per_page' => 10
       		 		));	?>
       		<?php $people = get_posts(array(
       				'post_type' => 'people',
       				'posts_per_page' => 2,
       				'orderby' => 'rand'
       		 		));	?>
       		<?php $mergedposts = array_merge( $blogposts, $people );?>
       		<?php global $post;?>
       		<?php foreach( $mergedposts as $post )  {

    the trouble is this displays the $blogposts, followed by the $people posts. I want it to take in all of the posts and spit them out randomly.

    I’ve scoured all over but can’t figure this one out!

    Any help is appreciated.


Viewing 1 replies (of 1 total)
Viewing 1 replies (of 1 total)
  • The topic ‘Combine Queries – Randomise Results’ is closed to new replies.