Posts only from 1 category and oldest first (2 posts)

  1. stlpixurs
    Posted 3 years ago #

    Okay, so I have this template and everything is working great but I just can't seem to wrap my head around this WordPress PHP. Here's what I need to do:

    On my main page, I need to show only posts within a certain category (ID=4) and I need them to display oldest first. Here is my current index.php:

    [code moderated - please use the pastebin]

    Any help would be greatly appreciated as I've literally gotten a headache trying to wrap my head around this stuff.

  2. Michael
    Part-Time Forum Moderator
    Posted 3 years ago #

    you will need to add a query before the loop;



    <?php global $query_string;
    query_posts($query_string . '&posts_per_page=1&cat=4&orderby=date&order=ASC'); ?>

    check all parameters http://codex.wordpress.org/Class_Reference/WP_Query#Parameters

Topic Closed

This topic has been closed to new replies.

About this Topic