• Is it possible to change the order of posts, showing the oldest on a page first and the latest last, rather than the other way around?

    I know that this goes against conventional blog setups, but I feel it would help readability of a journal-type blog, being presented in a chronological fashion much like a book (read printed diary).

Viewing 9 replies - 1 through 9 (of 9 total)
  • Thread Starter pezastic

    (@pezastic)

    OH, you’re so awsome! I see that the easiest way to do this is to add “?order=asc” onto the end of any WP URI. But, if I want to change the archives and cats, I would have to alter wp-blog-header.php.

    How about having the archives and cats display in chronological order, but the index page in default order? Would the best way of doing that be to alter wp-blog-header.php and then redirect to a “index.php?order=desc” frontpage?

    Or, could I do something with permalinks and .htaccess to do this?

    Since ‘order’ is a WP variable, you could do something like this, before wp-blog-header.php is called in your template:

    if (!empty($_SERVER["QUERY_STRING"]))
    $order='asc';

    This should work for 1.5:

    if (!is_home())
    $order='asc';

    Thread Starter pezastic

    (@pezastic)

    That’s confusing me. Can you explain it to me like I’m two years old? The linked thread said to alter wp-blog-header.php. Now you’re saying to place that snippet in my template (where)? Again, what I want is for the index to show posts in default order (i.e., desc) and the archives and categories pages to be in chronological order (i.e., asc). BTW, I’m using WP 1.5.

    Try editing it into the beginning of the index.php template (for 1.5, I believe this should be the one in the blog’s root, and not the theme’s–if you use one).

    And when I say “into the beginning,” I mean just that. Add it to the initial <?php ... ?> tags found in the template, just above the require line that adds wp-blog-header.php.

    Thread Starter pezastic

    (@pezastic)

    I tried this for my index.php file:

    <?php
    if (!is_home())
    $order="asc";
    /* Don"t remove this line. */
    require("./wp-blog-header.php");
    ?>

    It gave me a “…Call to undefined function: is_home()…” error. (Why is that?) So, I changed the index.php file to this:

    <?php
    if (!empty($_SERVER["QUERY_STRING"]))
    $order="asc";
    /* Don"t remove this line. */
    require("./wp-blog-header.php");
    ?>

    Is that what you had in mind? It seems to be set up the way I wanted it to be now.

    The two basically do the same thing. So if it works, it works.

    is_home() is one of the new is_pagetype *variables* in 1.5. The error about it being undefined seems like a bug/beta issue.

    Thread Starter pezastic

    (@pezastic)

    As a follow-up to this, “yes” it worked, but the navigation links were impossible to set up in a fluid manner. IMHO, more emphasis should be put on making WordPress more flexible when it comes to navigating around the blog. Even at default, with everything in desc order, navigation is difficult to set up. I don’t know what I would have done without the scriptygoddess nav plugins.

    Kafkaesqui – it’s undefined because he used it before any includes. Had he used it after the inclusion of the header file, it would have been OK, but the query would have already been run, rendering the check useless. Checking for an empty query string seems reasonable to me.

    Tg

Viewing 9 replies - 1 through 9 (of 9 total)
  • The topic ‘Possible to Change the Order of Posts?’ is closed to new replies.