Using blog pages with multiple loops
-
For the index page on my site I am displaying Uncategorized posts and posts of a particular category called “Gigs”, using two separate loops. I want to be able to use blog pages (limiting a certain number of posts to be displayed per page) with the Uncategorized posts, without affecting the Gigs posts.
Here’s my code so far:
<div class="gig_schedule">
<h4>Gig Schedule</h4><?php query_posts('category_name=Gigs&showposts=10'); ?>
<?php if (have_posts()) : ?>
<?php while (have_posts()) : the_post(); ?>
<b><?php the_date('F j') ?></b> - <a href="<?php the_permalink() ?>" rel="bookmark"><?php the_title(); ?></a><?php endwhile; ?>
<?php else : ?>
No gigs are currently scheduled.<?php endif; ?>
</div><?php query_posts('category_name=Uncategorized'); ?>
<?php if (have_posts()) : ?>
<?php while (have_posts()) : the_post(); ?>
<h3><?php the_title(); ?></h3>
<h4><?php the_date() ?></h4>
<?php the_content(); ?>
<p class="cite"><a href="<?php the_permalink() ?>" rel="bookmark" title="Permanent link for <?php the_title(); ?>">#</a> | Posted by <?php the_author() ?> at <?php the_time() ?> | <?php edit_post_link('Edit','','|'); ?> <?php comments_popup_link('No Comments', '1 Comment', '% Comments'); ?><?php endwhile; ?>
<div class="navigation">
<div class="alignleft"><?php next_posts_link('« Previous Entries') ?></div>
<div class="alignright"><?php previous_posts_link('Next Entries »') ?></div>
</div><?php else : ?>
<?php endif; ?>
Any ideas?
- The topic ‘Using blog pages with multiple loops’ is closed to new replies.