Designing the future of your business!

How to query a loop for second time on same page?

Posted September 18th, 2011 by Dimitar with No Comments

Well prety easy…

Just put  <?php rewind_posts(); ?> between the loops.

See example bolow:

<?php query_posts(‘posts_per_page=5′); ?>

   <?php while ( have_posts()) : the_post(); ?>
	<?php if (has_tag('')) { ?>

	<?php }; ?>
<?php endwhile; ?>
<?php rewind_posts(); ?>
<?php query_posts('posts_per_page=5'); ?>
    <?php while ( have_posts()) : the_post(); ?>
	<?php if (has_tag('')) { ?>
	<?php }; ?>
<?php endwhile; ?>

Leave a comment