Hi,
I've been trying to solve this problem for hours, and despite all the research can't seem to figure it out. However, I think the solution is probably a very simply one.
I'm trying to use multiple loops on a template page to display the latest post from a certain category, and then below it display the titles of previous post.
While researching I found that the article at http://codex.wordpress.org/The_Loop#Multiple_Loops_in_Action included the code I pretty much needed. And I essentially just copied it:
<?php $my_query = new WP_Query('cat=6&posts_per_page=1');
while ($my_query->have_posts()) : $my_query->the_post();
$do_not_duplicate = $post->ID;?>
<?php the_title(); ?> <br/>
<?php the_content(); ?>
<?php endwhile;wp_reset_query(); ?>
<?php if (have_posts()) : while (have_posts()) : the_post();
if( $post->ID == $do_not_duplicate ) continue; ?>
<?php the_title(); ?>
<?php endwhile; endif; ?>
The code works perfectly on index.php however, when I place it in a page template file, the second loop displays the title of the page it's on - and not the title of posts.
What's going on here?
Thanks so much for the help!