Support » Plugins » Second Loop not displaying all posts

  • Resolved daboo


    Hey all. I have a secondary loop on some of my pages displaying posts of a specific category. This loop is currently displaying 10 of 18 posts in this category, and I can’t figure out why. There is a counter in the loop to wrap each five posts in a div, but so far it isn’t displaying more than two divs. Code for the secondary loop:

    query_posts('cat=8'); /* cat with 18 posts */
    $counter = 1;
    if (have_posts()) :
    	while (have_posts()) : the_post();
    	if ($counter == 1) { echo '<div class="licont" style="float:left;">'; } ?>
    			<span class="icon_sprite year_icon year_<?php echo the_time('Y'); ?>"></span>
    			<a href="<?php the_permalink(); ?>" title="<?php the_title_attribute(); ?>"><?php the_post_thumbnail('thumbnail') ?></a><br />
    			<a href="<?php the_permalink(); ?>" title="<?php the_title_attribute(); ?>">
    				<?php echo substr(preg_replace('/([^>]*)(\,|:)([^>]*)/', '$1', get_the_title()), 0, 21); ?>
    		<?php if ($counter == 5) { echo '</div>'; $counter = 1; } else { $counter++; } ?>
    	<?php endwhile; ?>
    <?php endif; ?>

    Does anyone more familiar with the loop (or php) see where I went wrong? Presently this loop displays the ten most recently posts chronologically. Changing the dates of the posts does change which posts are displayed, but not the number which are displayed. Thanks in advance

Viewing 2 replies - 1 through 2 (of 2 total)
Viewing 2 replies - 1 through 2 (of 2 total)
  • The topic ‘Second Loop not displaying all posts’ is closed to new replies.