Forums

Sort by date? (not reverse) (8 posts)

  1. digitaltoast
    Member
    Posted 6 years ago #

    I want to do is sort by date, not reverse date (default). ie: newest posts last. I have a travelogue, and of course, this doesn't make sense in the "current" order
    I've been through the options plenty of times, I just can't see it. Thanks

  2. MYP4
    Member
    Posted 6 years ago #

    Any luck with this yet? I have the same issue. :-(

    MYP4

  3. digitaltoast
    Member
    Posted 6 years ago #

    Nope, I've asked several questions here and had 1 reply. I'm fairly sure these forums are "dead" now, but I can't find a "proper" support forum! The layout of the forums is VERY confusing, and search sometimes doesn't work, so that doesn't help.

  4. Les Bessant
    Moderator
    Posted 6 years ago #

    These forums are very much alive, actually. It's the sheer number of posts that mean some questions get missed. I agree about the layout, though.

    The reason you can't find an option to sort posts in the order you want is because there isn't an actual option. What you have to do is edit the index.php file in your theme folder.

    Look near the top for a line like this:

    <?php if (have_posts()) : ?> or <?php if ($posts) : foreach ($posts as $post) : start_wp(); ?>

    it will certainly have the if (have_posts()) bit.

    Now immediately above that line, add this:

    <?php query_posts('order=ASC'); ?>

    Save the file and load your blog. Make sure you keep a backup of the file in case you make a mistake, or it goes wrong.

  5. digitaltoast
    Member
    Posted 6 years ago #

    You're a genius! Many thanks!

  6. Les Bessant
    Moderator
    Posted 6 years ago #

    Genius? Naaah, I just happened to do the same thing a week or two ago!

  7. tapirul
    Member
    Posted 5 years ago #

    this is very useful, indeed, but how can I reorder the posts in only one category? I have a category which is a kind of old diary (I am transcribing and old diary actually), and I would like, in this category only, the posts to be ordered older first
    thank you

  8. moshu
    Member
    Posted 5 years ago #

    You should create a Category_Templates for displaying that special cat and change the code only in that template.

Topic Closed

This topic has been closed to new replies.

About this Topic

Tags

No tags yet.