Support » Themes and Templates » Multiple loop weirding out my comments

  • xiscomax

    (@xiscomax)


    I’m trying to use a loop inside the main loop of the single.php page.
    This code is run just before calling the comments of staff.

    Here’s the basic skeleton

    <!--photos here-->
    
    <div id="photos">
    
    		<?php $recent = new WP_Query("showposts=8"); while($recent->have_posts()) : $recent->the_post();?>
    		<a href="<?php the_permalink() ?>"><img style="float:left; margin:0px 4px 20px 4px; width:100px; height:100px; -moz-border-radius: 5px;
     border-radius: 5px; -webkit-border-radius: 5px;" src="<?php echo get_post_meta($post->ID, "thumbnail", true); ?>" alt="         <?php the_title(); ?>" /></a>
    		<?php endwhile; ?>
      </div>	
    
    <!--photos end-->

    This all works fine, and displays as needed. BUT — if this loop finds posts, then when I make a comment on any page, it shows up on the “premium” post and this comment also appears on ALL my posts — even making other comments disappear.

    However, if this loop does NOT find posts, the comments seem to work as expected. It seems that the comments are somehow being sent within this loop usual

    Can anyone discern what may be happening here? Thanks so much!

    Here´s the complet skeleton

    [Code moderated as per the Forum Rules. Please use the pastebin]

    `
    It shows me error on line 51 <? Php endwhile; else:?>

    Thanks

  • The topic ‘Multiple loop weirding out my comments’ is closed to new replies.