WordPress.org

Forums

[resolved] putting individual day archives in ascending order (4 posts)

  1. bradyjfrey
    Member
    Posted 9 years ago #

    I've attempted to put individual archive days in ascending order, with little affect.

    I started off with putting this in my archive.php file:

    <?php /* If this is a daily archive */ } elseif (is_day()) { ?>
    <h2 class="entrydate">Archive for <?php the_time('l, F jS, Y'); ?></h2>
    <?php query_posts("day=$current_day&order=ASC"); ?>

    This does not put an individual day's post in ascending order -- it puts all of the previous posts, but ascending by date, not time for that day.

    I attempted simply:

    <?php /* If this is a daily archive */ } elseif (is_day()) { ?>
    <h2 class="entrydate">Archive for <?php the_time('l, F jS, Y'); ?></h2>
    <?php query_posts("order=ASC"); ?>

    Same result as above.

    Example of how it should look for a single day:
    Single day home page for the 27th, will change if you look at this the 28th
    Single day archive page

    That archive page uses the standard:

    <?php /* If this is a daily archive */ } elseif (is_day()) { ?>
    <h2 class="entrydate">Archive for <?php the_time('l, F jS, Y'); ?></h2>

    You can see that on the home page the posts are in the order I prefer. To do this I use:

    <?php $current_month = date('m'); ?>
    <?php $current_year = date('Y'); ?>
    <?php $current_day = date('d'); ?>

    <?php query_posts("year=$current_year&monthnum=$current_month&day=$current_day&order=ASC"); ?>

    Above my index loop. If I were to do that on a archive page it would simply show the posts for a single day.

    Any ideas? Thank you:)

  2. bradyjfrey
    Member
    Posted 9 years ago #

    Resolved via Andrew Krespanis with:

    <?php query_posts('day='. get_the_time('d') .'&order=ASC'); ?>

  3. leftjustified
    Member
    Posted 9 years ago #

    query_posts('day='. get_the_time('d') .'&order=ASC');

    :)

    Do'h, you beat me to it.

  4. myelin
    Member
    Posted 8 years ago #

    If you want to do this without changing any code, you could use a tiny plugin I made a while ago. It makes WordPress think that order=ASC is always in the URL, so all archives end up in ascending order:

    http://www.myelin.co.nz/post/2006/2/24/#200602241

    Here's another thread about ascending date order in archives:

    http://wordpress.org/support/topic/10355

Topic Closed

This topic has been closed to new replies.

About this Topic

Tags

No tags yet.