How to reset the post query and use Multi-Pass Loop in WordPress
A rewind_posts() function is used to reset the post query and loop counter,allowing us to do another Loop using same content as first Loop.Place this function call directly after finishing first loop.
Example:-
Here is an example that processes the main Loop content twice:
<?php while(have_posts()) :the_post(); ?>
<!------content--->
<?php endwhile; ?>
<?php rewind_posts();?>
<?php while (have_posts()) : the_post(); ?>
<!---content---->
<?php endwhile; ?>
Related posts:-
How To Add Meta Descriptions To Your Posts in WordPress Using Coding ?
How To Create Link To External Resources In WordPress Without Plugin ?
How to display posts from specific category on the front page as feature in Worpress website.
How to display post according number using query_posts() in WordPress.
Total Page Visits: 4745 - Today Page Visits: 5
