Support » Themes and Templates » Reverse order of posts in archives bug?

  • Resolved pentascape


    Useful info:
    WP ver: 2.1.3
    If you get asked for a user and pass, use view and find respectively.

    OK, I have put in previous and next links using the previous_post_link and next_post_link functions respectively on the single.php template.

    Correct me if I’m wrong, but wp’s default order for posts is chronological, most recent first. Why is the order different to what comes out as a result of archive.php?

    Example: lets take the category Landscapes which has the following ‘posts’ in this order:

    1. Stumpy Mountain
    2. Red Rocks
    3. In the middle of nowhere

    If you click on the first ‘post’, Stumpy Mountain, you will notice previous and next links at the top. Flick through these links, you will notice the order is now reversed.

    1. In the middle of nowhere
    2. Red Rocks
    3. Stumpy Mountain

    Loop snippet for the archive.php (category listing template)

    <? while (have_posts()) : the_post(); ?>
    		<a href="<? the_permalink() ?>">
    			<img src="<? print get_post_meta($post->ID, 'imgId', true); ?>_.jpg" />
    			<span class="title"><? the_title(); ?></span>
    	<? endwhile; ?>

    Previous and next links on single.php inside the loop:
    `<div class=”postRoll”>
    <span class=”left”><? previous_post_link(‘« %link’,’%title’,TRUE) ?></span>
    <span class=”right”><? next_post_link(‘%link »’,’%title’,TRUE) ?></span>
    <br class=”clear” />

    Does anyone know what is going on?
    Now an obvious hack would be to swap previous_post_link and next_post_link around, but I shouldn’t have to do that – it programatically doesnt make any sense.

    Titles don’t show up on the single.php template, don’t worry about that, I’m aware of it and its an unrealted issue.

Viewing 1 replies (of 1 total)
  • Um, I think this may just be a case of not getting my head around the fact blogs work in order of recent first.
    Problem solved with hack, wp was right to do that funny ordering thing. I think. I’ll mark the issue as resolved, but comments on this phonomenon are welcome.

Viewing 1 replies (of 1 total)
  • The topic ‘Reverse order of posts in archives bug?’ is closed to new replies.