WordPress.org

Ready to get started?Download WordPress

Forums

[resolved] Reverse order of posts in archives bug? (2 posts)

  1. pentascape
    Member
    Posted 7 years ago #

    Useful info:
    WP ver: 2.1.3
    Site: http://www.viewfindergallery.com/
    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(); ?>
    	<li>
    		<a href="<? the_permalink() ?>">
    			<img src="http://www.viewfindergallery.com/_img/<? print get_post_meta($post->ID, 'imgId', true); ?>_.jpg" />
    			<span class="title"><? the_title(); ?></span>
    		</a>
    	</li>
    	<? 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" />
    </div>'

    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.

    *EDIT*
    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.

  2. pentascape
    Member
    Posted 7 years ago #

    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.

Topic Closed

This topic has been closed to new replies.

About this Topic