query_posts on a page
-
Hello. I’m trying to create a template for a certain page so that it will display, aside from the page’s content, a box of the latest posts from a chosen category.
Here’s the code from the page template I’ve come up with:
<?php get_header(); ?> <div id="content"><a name="content"></a> <?php if (have_posts()) : ?> <?php while (have_posts()) : the_post(); ?> <div class="single" id="post-<?php the_ID(); ?>"> <div class="title"> <h2><a href="<?php the_permalink() ?>" rel="bookmark" title="Permanent Link to <?php the_title(); ?>"><?php the_title(); ?></a></h2> </div> <div class="cover"> <div class="entry"> <?php the_content('Read the rest of this entry »'); ?> </div> </div> </div> <?php endwhile; endif; ?> </div> <div id="newsbox"> <h3>What's New</h3> <?php query_posts('cat=18'); ?> </div> <?php get_footer(); ?>
The What’s New displays properly and in the proper place on the page, but there’s nothing afterward. I’ve gone through the codex, and I’ve got the rudiments of how tags work, but I’m still pretty new to WordPress. I’m guessing the solution has to do with the loop, but I don’t know how to fix it.
Viewing 2 replies - 1 through 2 (of 2 total)
Viewing 2 replies - 1 through 2 (of 2 total)
- The topic ‘query_posts on a page’ is closed to new replies.