WordPress.org

Ready to get started?Download WordPress

Forums

[resolved] Loop within a loop - comments problem (2 posts)

  1. extatix
    Member
    Posted 4 years ago #

    So I've build a piece of code which shows the last 10 posts between the main content of a post (single) and the comments. Problem is: the comments are based on the last post from my code. How do I fix this?

    I use this piece of code:

    <ul>
    <?php $cuery =  new WP_query('posts_per_page=10');
    while ( $cuery->have_posts()) : $cuery->the_post(); ?>
    <li>
    do stuff
    </li>
    <?php endwhile; ?>
    </ul>
    [ content from single ]
    MY CODE
    <?php comments_template('', true); ?>
    [endwhile; endif;]
  2. extatix
    Member
    Posted 4 years ago #

    wp_reset_query(); is the solution

Topic Closed

This topic has been closed to new replies.

About this Topic

Tags