Support » Fixing WordPress » List of posts in one category only

Viewing 4 replies - 1 through 4 (of 4 total)
  • This should do it; use before The Loop:

    <?php query_posts('category_name=my-category&orderby=post_date'); ?>

    Replace my-category with the category’s “nicename” (category name in the url-encoded format, i.e. category slug). You can also use cat=N, where N is the category ID. To force the number of posts, add showposts:

    <?php query_posts('category_name=my-category&orderby=post_date&showposts=X'); ?>

    Replace X with the number of posts to display.

    If you are running the loop twice can you put in that before one run but not the next ?

    I don’t think so, Root; but you should be able to reinitialize the second loop (to your defaults) with something like:

    <?php query_posts('orderby=post_date'); ?>

    Hi, I try to show the 3 current posts from one category in a list. The posts date are in the future.
    I tryed this code: <?php query_posts(‘cat=6&orderby=post_date&showposts=2’); ?>
    What is wrong?
    Thank.
    Maggie

Viewing 4 replies - 1 through 4 (of 4 total)
  • The topic ‘List of posts in one category only’ is closed to new replies.