Using rewind_posts for displaying multiple categories
-
I would like to use one just wp query to query 5 different categories. My problem is when i use it my first query doesnt follow my conditions and same goes for the rewind_posts how can i make this possible?
<?php $original = new WP_Query(); $original ->query('cat=12,13,14&showposts=2');?> <?php while ($original ->have_posts()) : $original ->the_post(); ?> <!-- See if the current post is in category 3. --> <?php if ( in_category('12') ) { ?> <!--content--> <?php } ?> <?php endwhile; ?> <?php rewind_posts(); ?> <?php while (have_posts()) : the_post(); ?> <?php if ( in_category('13') ) { ?> <!--content--> <?php } ?> <?php endwhile; ?> <?php rewind_posts(); ?> <?php if ( in_category('14') ) { ?> <?php while (have_posts()) : the_post(); ?> <!--content--> <?php endwhile; ?> <?php rewind_posts(); ?> <?php if ( in_category('15') ) { ?> <?php while (have_posts()) : the_post(); ?> <!--content--> <?php } ?> <?php endwhile; ?>
Viewing 5 replies - 1 through 5 (of 5 total)
Viewing 5 replies - 1 through 5 (of 5 total)
- The topic ‘Using rewind_posts for displaying multiple categories’ is closed to new replies.