Hello people.
I'm working on a theme that has a normal loop on the single.php page. After this loop, there is a custom WP_query loop that displays some posts from another category. Then after these posts the comments template should show up. My code is as follows:
<?php
if(have_posts()) :
while(have_posts()) : the_post(); ?>
// Show single post stuff
<?php
$my_query1 = new WP_Query('cat=6&showposts=4&orderby=rand');
while ($my_query1->have_posts()) : $my_query1->the_post(); ?>
// Show 4 posts from cat 6
<?php endwhile; ?>
<?php comments_template(); ?>
<?php
endwhile;
endif;
?>
The comments template shows up, but it is "linked" to the last post of the custom query (the last post from category 6). So when I post a comment, it actually gets posted to a different post (in category 6).
I've tried adding <?php $wp_query = $temp_query; ?> before the custom loopt and <?php $temp_query = $wp_query; ?> after it, but that didn't help.
How do I fix this?