Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- <? $args = array(
- 'post_type' => 'post',
- 'posts_per_page' => 3,
- 'category__not_in' => array( 268, 269 )
- );
- $homePosts = new WP_Query($args);
- $args = array(
- 'post_type' => 'post',
- 'category_name' => 'in-the-media',
- 'posts_per_page' => 3
- );
- $inthemediaPosts = new WP_Query($args);
- $args = array(
- 'post_type' => 'post',
- 'category_name' => 'bt-insights',
- 'posts_per_page' => 3
- );
- $insightsPosts = new WP_Query($args);
- $allqueries = array($homePosts,$inthemediaPosts,$insightsPosts);
- foreach ($allqueries as $myquery) {
- while ($myquery->have_posts()) : $myquery->the_post(); ?>
- $insightsPosts = new WP_Query($args);
- for ($i = 0; $i < 3; $i++) {
- if ($homePosts->post_count > $i)
- echo $homePosts->posts[$i]->post_title;
- if ($inthemediaPosts->post_count > $i)
- echo $inthemediaPosts->posts[$i]->post_title;
- if ($insightsPosts->post_count > $i)
- echo $insightsPosts->posts[$i]->post_title;
- }
- while($allqueries[0]->have_posts() || $allqueries[1]->have_posts() || $allqueries[2]->have_posts()) {
- if ($allqueries[0]->have_posts()) $allqueries[0]->the_post();
- if ($allqueries[1]->have_posts()) $allqueries[1]->the_post();
- if ($allqueries[2]->have_posts()) $allqueries[2]->the_post();
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement