OK… kinda a noob here, but working on coding my site and I’m trying to use a loop inside the main loop on the single.php page. It basically runs a query for a certain number of posts with a certain tag. If it finds posts, then it displays a link (in the form of an image pulled from a custom field) to the post(s). This code runs just before I call the comments template.
Here’s the basic skeleton:
<?php $premium_Posts = new WP_query('tag=premium&showposts=6') ; while ($premium_Posts->have_posts()) : $premium_Posts->the_post(); ?> <!-- Do all my custom stuff inside here --> <?php endwhile; ?>
This all works fine, and displays as needed. BUT — if this loop finds posts, then when I make a comment on any page, it shows up on the “premium” post and this comment also appears on ALL my posts — even making other comments disappear.
However, if this loop does NOT find posts, the comments seem to work as expected. It seems like the comments are somehow being posted within this custom loop, but I have my “endwhile” statement before the comments template is called.
Can someone discern what might be happening here? Thanks so much!
- The topic ‘Multiple Loop weirding out my comments!’ is closed to new replies.