Advertisement
Guest User

Untitled

a guest
Oct 22nd, 2012
35
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.24 KB | None | 0 0
  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. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement