• Resolved pbenj

    (@pbenj)


    well done Allan Cole and WordPress – really enjoying this theme.

    My query:

    I’d like the oldest posts to appear first and the newest to appear last. is there any simple way of doing this?

    I’m relatively new to wordpress – appreciate your help on this…

    Thanks!

    PS apologies if this topic has already been covered – couldn’t find it in the archives.

Viewing 10 replies - 1 through 10 (of 10 total)
  • To resort the order of posts, using the WordPress Default theme for example, in the wp-content/themes/default/index.php file, just before this line, <?php if (have_posts()) : ?>, put this:

    <?php query_posts($query_string . '&orderby=date&order=ASC'); ?>

    The query_posts() article explains the arguments in detail.

    Thread Starter pbenj

    (@pbenj)

    thanks for your speedy reply Michael!

    just tried it with the Default Theme and it works OK. Unfortunately, I can’t get it to work with the Autofocus Theme. I’ll read the query_posts() article – maybe I’ll find something there…

    Thread Starter pbenj

    (@pbenj)

    I’ve tried again but no success. the line in the Autofocus Theme looks a little different to the one above:

    <?php while ( have_posts() ) : the_post() ?>

    any ideas what else I could try?

    Put

    <?php query_posts($query_string . '&orderby=date&order=ASC'); ?>

    right before

    <?php while ( have_posts() ) : the_post() ?>

    Thread Starter pbenj

    (@pbenj)

    Thanks Michael. I have added that line exactly as you’ve described but it only worked with the WordPress Default (and other similar) themes. the Autofocus Theme
    remains completely unchanged by that bit of code. have also tried deleting cache and using different browsers…

    Why you would want to do that with that theme…:)

    Anyways, that theme uses home.php to display those posts so make the change there.

    Thread Starter pbenj

    (@pbenj)

    I’d like to use it to present a photo essay. I’ve taken out the dates, set reading to show 4 posts per page and now it’d be nice to advance through the story by going ‘forwards’ as it were and not by clicking on the link “older posts” down on the left. hope that makes sense ??

    Thread Starter pbenj

    (@pbenj)

    could try switching the nav links I suppose?

    Just wanted to thank you MichaelH. I’ve been looking for the same thing and other code didn’t work (possibly because they were for older versions of WP or a basic theme). Your code worked perfect and is exactly what I needed.

    Has anyone been able to get this to work with AutoFocus ? I have tried the above suggestions to no avail with this theme. The theme was used for a photoblog from a bike tour and now that the tour is over, it would be nice to display posts from the beginning so folks can follow the trip in order, not backwards. The website is: https://cycling-to-everest.thebiergarten.com .

Viewing 10 replies - 1 through 10 (of 10 total)
  • The topic ‘change order of posts – oldest first’ is closed to new replies.