WordPress.org

Ready to get started?Download WordPress

Forums

Recent posts in single, wrong comments (1 post)

  1. allstar
    Member
    Posted 4 years ago #

    On a 'singular' I've a something very similar to the below, the content reads fine, (as does next/prev links), the recent posts shows. Then everything goes a little ka-ka, the comments that should be attached to this post vanish. I am both making a new query and reseting the WP_query yet things are not reset. Anyboy know why OR how to solve it?

    <?php while (have_posts()) : the_post(); ?>
    <?php the_content(); ?>
    
    <?php $RecentPosts = new WP_Query(array('showposts' => 5, 'what_to_show' => 'posts', 'nopaging' => 0, 'post_status' => 'publish', 'caller_get_posts' => 1));
    if ($RecentPosts->have_posts()) : ?>
    <ul>
    <?php while ($RecentPosts->have_posts()) : $RecentPosts->the_post(); ?>
    <li><?php if ( get_the_title() ) the_title(); else the_ID(); ?></li>
    <?php endwhile; ?>
    </ul>
    <?php wp_reset_query();
    endif; ?>
    
    <?php comments_template(); ?>
    <?php endwhile; ?>

Topic Closed

This topic has been closed to new replies.

About this Topic