Loop: Posts from a single category ID
-
I am using categories to separate posts in navigation. For instance, I have an “Advice Centre” link in the navigation that I want to only pull in posts from that category. The problem is, it only displays the first one, and not any of the others.
The code I am using is:
<h2>Advice Centre</h2> <?php $posts = get_posts( "category=1" ); ?> <?php while (have_posts()) : the_post(); ?> <div class="post"> <h3 id="post-<?php the_ID(); ?>"><a href="<?php the_permalink() ?>" rel="bookmark" title="Permanent Link to <?php the_title_attribute(); ?>"><?php the_title(); ?></a></h3> <div class="entry"><?php the_excerpt(); ?></div> </div> <?php endwhile; ?>
I would be very happy if someone could show me where I’ve gone wrong – thanks in advance.
Viewing 3 replies - 1 through 3 (of 3 total)
Viewing 3 replies - 1 through 3 (of 3 total)
- The topic ‘Loop: Posts from a single category ID’ is closed to new replies.