Multiple Loops
-
I’m trying to have two Loops on my index.php page with each one only displaying one category. Can anyone give me an idea where I’m going wrong. Here’s the code:
<?php query_posts('cat=1&showposts=2'); ?><?php if (have_posts()) : ?>
<?php while (have_posts()) : the_post(); ?>
<div class="post" id="post-<?php the_ID(); ?>">
<h3><a href="<?php the_permalink() ?>" rel="bookmark" title="Permanent Link to <?php the_title(); ?>"><?php the_title(); ?></a></h3><div class="entry">
<?php the_content('Read the rest of this entry »'); ?>
</div></div>
<?php endwhile; ?>
<?php query_posts('cat=2&showposts=2'); ?>
<?php if (have_posts()) : ?>
<?php while (have_posts()) : the_post(); ?>
<div class="post" id="post-<?php the_ID(); ?>">
<h3><a href="<?php the_permalink() ?>" rel="bookmark" title="Permanent Link to <?php the_title(); ?>"><?php the_title(); ?></a></h3><div class="entry">
<?php the_content('Read the rest of this entry »'); ?>
</div></div>
<?php endwhile; ?>
<?php else : ?>
<h3 class="center">Not Found</h3>
<p class="center">Sorry, but you are looking for something that isn't here.</p><?php endif; ?>
This gives me a parse error “unexpected $”. I’ve read about multiple loops in the codex and on the forums but I’m still not getting it. Any help or advise would be appreciated. Thanks.
The topic ‘Multiple Loops’ is closed to new replies.