How to select and display posts from a category

by Romy Cayabyab on February 13, 2009

in Tips, Techniques & How-to's

This is an update of an entry we wrote last week, How to list posts by category.

Here is another block of codes that you can use to display selected posts from a category. The one you see on the right panel of this page like issues // must reads is an example:

 <h2>Category description</h2>
   <ul>
   <?php query_posts(‘category_name=Category&showposts=x’); while (have_posts()) :  the_post(); ?>
   <li><a href=”<?php the_permalink() ?>” rel=”bookmark”><?php the_title(); ?> </li>
<?php endwhile; ?>

Replace “Category” with the name of the category you want to list posts from and “x” with the number of posts you want to show.

Other suggested articles

[Not necessarily related to above post; Automatically generated]

{ 1 comment… read it below or add one }

James J. February 15, 2009 at 1:38 pm

Thanks for the info. Just exactly what I was looking for.

Reply

Leave a Comment

Previous post:

Next post: