WordPress.org

Support

Support » How-To and Troubleshooting » Recent posts in single, wrong comments

Recent posts in single, wrong comments

  • 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; ?>
  • The topic ‘Recent posts in single, wrong comments’ is closed to new replies.
Skip to toolbar