Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- <?php $cats = array(17, 31, 5); //the category ids
- foreach ($cats as $cat) :
- $args = array(
- 'posts_per_page' => 2, // max number of post per category
- 'category__in' => array($cat->term_id)
- );
- query_posts($args);
- if (have_posts()) :
- echo $cat->name;
- while (have_posts()) : the_post(); ?>
- <!--post output as usual-->
- <?php endwhile; ?>
- <?php else :
- echo 'No Posts for ' .$cat->name;
- endif;
- wp_reset_query(); ?>
- <?php endforeach; ?>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement