This week only. Pastebin PRO Accounts Christmas Special! Don't miss out!Want more features on Pastebin? Sign Up, it's FREE!
Guest

Untitled

By: a guest on Oct 22nd, 2012  |  syntax: None  |  size: 1.24 KB  |  views: 23  |  expires: Never
download  |  raw  |  embed  |  report abuse  |  print
Text below is selected. Please press Ctrl+C to copy to your clipboard. (⌘+C on Mac)
  1. <? $args = array(
  2.     'post_type' => 'post',
  3.     'posts_per_page' => 3,
  4.     'category__not_in' => array( 268, 269 )
  5.   );
  6. $homePosts = new WP_Query($args);
  7.  
  8. $args = array(
  9.     'post_type' => 'post',
  10.     'category_name' => 'in-the-media',
  11.     'posts_per_page' => 3
  12.   );
  13. $inthemediaPosts = new WP_Query($args);
  14.  
  15. $args = array(
  16.   'post_type' => 'post',
  17.   'category_name' => 'bt-insights',
  18.   'posts_per_page' => 3
  19. );
  20. $insightsPosts = new WP_Query($args);
  21.  
  22. $allqueries = array($homePosts,$inthemediaPosts,$insightsPosts);
  23. foreach ($allqueries as $myquery) {
  24.   while ($myquery->have_posts()) : $myquery->the_post(); ?>
  25.        
  26. $insightsPosts = new WP_Query($args);
  27.        
  28. for ($i = 0; $i < 3; $i++) {
  29.     if ($homePosts->post_count > $i)
  30.         echo $homePosts->posts[$i]->post_title;
  31.     if ($inthemediaPosts->post_count > $i)
  32.         echo $inthemediaPosts->posts[$i]->post_title;
  33.     if ($insightsPosts->post_count > $i)
  34.         echo $insightsPosts->posts[$i]->post_title;
  35. }
  36.        
  37. while($allqueries[0]->have_posts() || $allqueries[1]->have_posts() || $allqueries[2]->have_posts()) {
  38.   if ($allqueries[0]->have_posts()) $allqueries[0]->the_post();
  39.   if ($allqueries[1]->have_posts()) $allqueries[1]->the_post();
  40.   if ($allqueries[2]->have_posts()) $allqueries[2]->the_post();
  41. }
clone this paste RAW Paste Data