Multiple loops break with this bit of code, any ideas why?
-
Commenting out the .images div will make the loops function properly, but with this code, the second loop will not function correctly.
Specifically: the second (main) loop disregards “blog pages show at most”, and clicking a post link wont link to the specified post, but to all posts.
First loop
<?php $my_query = new WP_Query('showposts=8&offset=0'); ?> <?php while ($my_query->have_posts()) : $my_query->the_post(); ?> <div class="posts" onclick="location.href='<?php echo get_permalink() ?>';" style="cursor: pointer;" class="fader"> <div class="texts2"> <span><h3><?php the_title(); ?></h3></span> </div> <div class="images"> <?php $thumbnail = wp_get_attachment_image_src(get_post_thumbnail_id(), 'small'); if (has_post_thumbnail()) { echo '<img class="circles" src="'.get_bloginfo('template_url').'/timthumb.php?src='.$thumbnail[0].'&w=94&h=94&zc=1&q=100" alt="'.get_the_title().'" />'; }?> </div><!--images--> </div><!--posts--> <?php endwhile; ?>
Second (main) loop
<div id="blogs"> <?php rewind_posts();?> <?php if (have_posts()) : ?> <?php while (have_posts()) : the_post();?> <div class="post"> <h2><?php the_title(); ?></h2> <div class="content"><?php the_content(); ?></div> </div><!--post--> <?php endwhile; ?> </div><!--blogs-->
Does anyone have any idea why the code within .images is breaking the next loop?
Am I forgetting to close something? I just need a few other pairs of eyes here! Thanks!ps. the loop in question here, is using the script timthumb to pull the featured images from the posts, I am using it to make a visual wall of post images.
Viewing 2 replies - 1 through 2 (of 2 total)
Viewing 2 replies - 1 through 2 (of 2 total)
- The topic ‘Multiple loops break with this bit of code, any ideas why?’ is closed to new replies.