Display all posts in a specific category
-
This seems easy but for some reason I can’t figure it out.
I am trying to create a template page that shows only posts from a specific category. I would like to display the full posts, not just the titles of the posts.
The page is called Reviews and will have all posts in the category Reviews, which is category ID 8.
This is the code I have so far. It shows the header but does not display any posts.
<?php
/*
Template Name: Reviews
*/
?>
<?php get_header(); ?>
<div id="content" class="narrowcolumn">
<?php if (have_posts()) : while (have_posts()) : the_post(); ?>
<div class="post" id="post-<?php the_ID(); ?>">
<h2><?php the_title(); ?></h2>
<div class="entry">
<?php the_content('<p class="serif">Read the rest of this page »
'); ?>
<?php link_pages('<strong>Pages:</strong> ', '
', 'number'); ?>
</div>
</div>
<?php endwhile; endif; ?>
<?php edit_post_link('Edit this entry.', '', '
'); ?>
</div>
<?php get_sidebar(); ?>
<?php get_footer(); ?>Thanks!
- The topic ‘Display all posts in a specific category’ is closed to new replies.