Trouble with Multiple Loop and Pagination
-
I’m trying to design a site just like GigaOm, where the homepage displays a Feature story, three featured headlines, then the standard Loop (which excludes that Featured category). In other words, like this.
What I tried so far seems to work, but when I click “Older Posts”, it just reprints the same posts without excluding newer ones:
<!--MAIN FEATURED--> <?php query_posts('showposts=1&cat=5'); ?> <?php while (have_posts()) : the_post(); ?> <h2><a href="<?php the_permalink() ?>" rel="bookmark"><?php the_title(); ?></a></h2> <div class="entry"> <?php the_content('<br /><span>»Read More</span>'); ?> </div> <?php endwhile; ?> <!--THREE FEATURED HEADLINES--> <?php query_posts('showposts=3&offset=1&cat=5'); ?> <ul> <?php while (have_posts()) : the_post(); ?> <li><a href="<?php the_permalink() ?>" rel="bookmark"><?php the_title(); ?></a></li> <?php endwhile; ?> </ul> <!--STANDARD LOOP--> <?php query_posts('cat=-5'); ?> <?php if (have_posts()) : ?> <?php while (have_posts()) : the_post(); ?> <div class="post" id="post-<?php the_ID(); ?>"> <h2><a href="<?php the_permalink() ?>" rel="bookmark" title="Permanent Link to <?php the_title_attribute(); ?>"><?php the_title(); ?></a></h2> <p class="postmetadata">Posted by <?php the_author_posts_link(); ?> on <?php the_time('F jS, Y') ?> <span class="commentcount"><?php comments_popup_link('No Comments »', '1 Comment »', '% Comments »'); ?></span></p> <div class="entry clearfloat"> <?php the_content('<br /><span>»Read More</span>'); ?> </div> </div> <?php endwhile; ?> <div class="navigation"> <div class="alignleft"><?php next_posts_link('« Older Entries') ?></div> <div class="alignright"><?php previous_posts_link('Newer Entries »') ?></div> </div> <?php else : ?> <h2 class="center">Not Found</h2> <p class="center">Sorry, but you are looking for something that isn't here.</p> <?php include (TEMPLATEPATH . "/searchform.php"); ?> <?php endif; ?>
I also noticed that on GigaOm, when you view /page/2/, the Featured box goes away. How is this done, since they’re both using the “index.php” template? I tried a “if is_home” conditional, but it didn’t work.
Thanks!
Viewing 5 replies - 1 through 5 (of 5 total)
Viewing 5 replies - 1 through 5 (of 5 total)
- The topic ‘Trouble with Multiple Loop and Pagination’ is closed to new replies.