WordPress.org

Support

Support » How-To and Troubleshooting » [Resolved] Front Page Posts Sorting Old To New

[Resolved] Front Page Posts Sorting Old To New

  • Greetings,

    I am WP 2.7 on FreeBSD 4.7 with MySQL 4.1.21.

    This is my second WP instance on this server but my first 2.7. Two posts have been made and both are showing up on the home page, however they are sorted oldest to newest instead of newest to oldest.

    How can I make it sort from newest to oldest?

    Best regards,
    Brenden

Viewing 11 replies - 1 through 11 (of 11 total)
  • Could be a MySQL thing, that use to happen:
    http://wordpress.org/support/topic/154622?replies=15

    Of course it could be intentional – coded into your theme???
    query_posts($query_string . '&order=DESC');
    would resolve that place before your loop.

    I saw the mysql issue as you have posted, however I am not quite to that version yet.

    I am not sure what to look for in my theme to confirm whether it is coded intentionally or not.

    Would I just place
    query_posts($query_string . ‘&order=DESC’);
    … in the index.php?

    That query_posts, if placed before the loop in your index.php should correct the problem.

    If your theme is coded to show oldest to newest I would guess you would see something similar with order=ASC, or you have a plugin doing that.

    No dice.

    Here is what my index.php looks like with your recommendation.

    <?php
    /**
     * @package WordPress
     * @subpackage Default_Theme
     */
    
    get_header(); ?>
    
            <div id="content" class="narrowcolumn">
            <?php query_posts($query_string . '&order=DESC'); ?>
            <?php if (have_posts()) : ?>
    
                    <?php while (have_posts()) : the_post(); ?>
    
                            <div <?php post_class() ?> id="post-<?php the_ID(); ?>">
                                    <h2><a href="<?php the_permalink() ?>" rel="bookmark" title="Permanent Link to <?php the_title_attribute(); ?>"><?php the_title(); ?></a></h2>
                                    <small><?php the_time('F jS, Y') ?> by <?php the_author() ?> </small>
    
                                    <div class="entry">
                                            <?php the_content('Read the rest of this entry &raquo;'); ?>
                                    </div>
    
                                    <p class="postmetadata"><?php the_tags('Tags: ', ', ', '<br />'); ?> Posted in <?php the_category(', ') ?> | <?php edit_post_link('Edit', '', ' | '); ?>  <?php comments_popup_link('No Comments »', '1 Comment »', '% Comments »'); ?></p>
                            </div>
    
                    <?php endwhile; ?>
    
                    <div class="navigation">
                            <div class="alignleft"><?php next_posts_link('&laquo; Older Entries') ?></div>
                            <div class="alignright"><?php previous_posts_link('Newer Entries &raquo;') ?></div>
                    </div>
    
            <?php else : ?>
    
                    <h2 class="center">Not Found</h2>
                    <p class="center">Sorry, but you are looking for something that isn't here.</p>
                    <?php get_search_form(); ?>
    
            <?php endif; ?>
    
            </div>
    
    <?php get_sidebar(); ?>
    
    <?php get_footer(); ?>

    I grep’d for order=ASC and didn’t find that either.

    Any other thoughts?

    In phpMyAdmin

    SELECT ID , post_date , post_title
    FROM wp_posts
    ORDER BY post_date DESC

    Sorry, that didn’t work either.

    Here are the results of that sql statment:

    mysql> SELECT ID , post_date , post_title
        -> FROM wp_posts
        -> ORDER BY post_date DESC;
    +----+---------------------+------------------------------------------------------------+
    | ID | post_date           | post_title                                                 |
    +----+---------------------+------------------------------------------------------------+
    | 61 | 2009-02-01 01:23:16 | Say Hello To My Little Friend! - Line 6 Amplifiers         |
    | 66 | 2009-02-01 01:21:45 | Say Hello To My Little Friend! - Line 6 Amplifiers         |
    | 65 | 2009-02-01 01:14:24 | Say Hello To My Little Friend! - Line 6 Amplifiers         |
    | 64 | 2009-02-01 01:13:16 | Say Hello To My Little Friend! - Line 6 Amplifiers         |
    | 63 | 2009-02-01 01:13:05 | Say Hello To My Little Friend! - Line 6 Amplifiers         |
    | 59 | 2009-02-01 00:40:40 | Say Hello To My Little Friend! - Line 6 Amplifiers         |
    | 62 | 2009-02-01 00:40:40 | An Amp On Roids                                            |
    | 60 | 2009-02-01 00:40:07 | An Amp On Roids                                            |
    | 53 | 2009-01-31 23:04:22 | Got JailBreak? - Must Have Apps For Your JailBroken iPhone |
    | 58 | 2009-01-31 22:06:53 | :: contact us ::                                           |
    | 56 | 2009-01-31 22:05:51 | :: contact us ::                                           |
    | 57 | 2009-01-31 22:05:27 | :: contact us ::                                           |
    | 55 | 2009-01-31 00:06:10 | Got JailBreak? - Must Have Apps For Your JailBroken iPhone |
    | 52 | 2009-01-31 00:03:11 | Got JailBreak? - Must Have Apps For Your JailBroken iPhone |
    | 50 | 2009-01-30 23:47:56 | pdanet                                                     |
    | 49 | 2009-01-30 23:34:26 | safari                                                     |
    | 51 | 2009-01-30 23:30:42 | Got JailBreak? - Must Have Apps For Your JailBroken iPhone |
    | 47 | 2009-01-30 23:30:06 | sbsetss                                                    |
    | 46 | 2009-01-30 23:25:19 | sbset                                                      |
    | 48 | 2009-01-30 23:21:37 | Got JailBreak? - Must Have Apps For Your JailBroken iPhone |
    | 45 | 2009-01-30 23:21:06 | Got JailBreak? - Must Have Apps For Your JailBroken iPhone |
    | 44 | 2009-01-30 23:19:55 | Got JailBreak? - Must Have Apps For Your JailBroken iPhone |
    | 42 | 2009-01-30 23:19:32 | backgrounderss                                             |
    | 41 | 2009-01-30 23:12:13 | backgrounder                                               |
    | 43 | 2009-01-30 23:09:15 | Got JailBreak? - Must Have Apps For Your JailBroken iPhone |
    | 39 | 2009-01-30 23:08:29 | screenshot                                                 |
    | 40 | 2009-01-30 23:07:14 | Got JailBreak? - Must Have Apps For Your JailBroken iPhone |
    | 38 | 2009-01-30 23:04:19 | winterboard                                                |
    | 37 | 2009-01-30 22:59:25 | Got JailBreak? - Must Have Apps For Your JailBroken iPhone |
    | 36 | 2009-01-30 22:59:21 | Got JailBreak? - Must Have Apps For Your JailBroken iPhone |
    | 35 | 2009-01-30 22:59:17 | Got JailBreak? - Must Have Apps For Your JailBroken iPhone |
    | 34 | 2009-01-30 22:56:57 | lockcal                                                    |
    | 33 | 2009-01-30 22:54:11 | Got JailBreak? - Must Have Apps For Your JailBroken iPhone |
    | 31 | 2009-01-30 22:53:54 | btt                                                        |
    | 30 | 2009-01-30 22:51:10 | mim                                                        |
    | 32 | 2009-01-30 22:46:10 | Got JailBreak? - Must Have Apps For Your JailBroken iPhone |
    | 29 | 2009-01-30 22:46:08 | Got JailBreak? - Must Have Apps For Your JailBroken iPhone |
    | 28 | 2009-01-30 22:46:03 | Got JailBreak? - Must Have Apps For Your JailBroken iPhone |
    | 26 | 2009-01-30 22:31:01 | aptbackup                                                  |
    | 27 | 2009-01-30 22:19:14 | Got JailBreak? - Must Have Apps For Your JailBroken iPhone |
    | 24 | 2009-01-30 22:18:22 | clippy                                                     |
    | 25 | 2009-01-30 22:01:10 | Got JailBreak? - Must Have Apps For Your Jailbroken iPhone |
    | 23 | 2009-01-30 17:04:57 | Got JailBreak? - Must Have Apps For Your Jailbroken iPhone |
    | 22 | 2009-01-30 17:03:32 | Got JailBreak? - Must Have Apps For Your Jailbroken iPhone |
    | 20 | 2009-01-30 16:55:41 | Got JailBreak? - Must Have Apps For Your JailBroken iPhone |
    | 21 | 2009-01-30 16:55:41 | Got JailBreak? - Must Have Apps For Your Jailbroken iPhone |
    | 15 | 2009-01-28 23:13:06 | p-640-480-6a2856a0-499c-4d0c-ada4-3eff1a17deda.jpeg        |
    | 12 | 2009-01-28 17:38:54 | :: about g.i.d ::                                          |
    | 17 | 2009-01-28 17:37:51 | :: about g.i.d ::                                          |
    | 54 | 2009-01-28 15:48:24 | :: meet our authors ::                                     |
    | 13 | 2009-01-28 15:48:11 | :: about g.i.d ::                                          |
    | 10 | 2009-01-28 15:47:54 | :: about g.i.d. ::                                         |
    |  9 | 2009-01-28 15:47:04 | ::about::                                                  |
    |  7 | 2009-01-28 15:40:08 | test                                                       |
    |  3 | 2009-01-28 15:23:51 | :: meet our authors ::                                     |
    | 11 | 2009-01-28 15:23:51 | :: meet our authors ::                                     |
    |  4 | 2009-01-28 15:23:32 | :: meet our authors ::                                     |
    |  8 | 2009-01-26 13:50:08 | About                                                      |
    |  2 | 2009-01-26 13:50:08 | :: about g.i.d ::                                          |
    +----+---------------------+------------------------------------------------------------+
    59 rows in set (0.06 sec)

    Well that shows all posts in newest to oldest date–that’s good.

    Deactivate all plugins, change to the WordPress Default theme–does it resolve the problem?

    Did as you requested, did not resolve the issue.

    Sorry, I’ve got nothing else…

    Found the problem. My oldest post was set to sticky.

    Thanks for your assistance!

    Good you found the problem, but the sticky post means only that post would be first, followed by the rest, in ASC date order.

Viewing 11 replies - 1 through 11 (of 11 total)
  • The topic ‘[Resolved] Front Page Posts Sorting Old To New’ is closed to new replies.