Andrew Charlton
Andrew Charlton

Reputation: 251

One Wordpress loop seems to be affecting the other

I have a wordpress loop to get most popular posts at the top of my index page like this:

<?php while ( $featured->have_posts() ): $featured->the_post(); ?>
endwhile;

and then the main loop below it to list all of the blog posts like this:

<?php while ( $featured->have_posts() ): $featured->the_post(); ?>
endwhile;

However both loops dont seem to be working together - in the main loop that is supposed to be grabbing all of the posts - it is not and is missing the first week of posts. Why is this happening?

Upvotes: 0

Views: 39

Answers (1)

Zack
Zack

Reputation: 106

You should use wp_reset_postdata() after first loop

Upvotes: 2

Related Questions