WordPress.org

Forums

How Do I Fix The Sort Order Of My Posts? (18 posts)

  1. cfcoder2
    Member
    Posted 7 years ago #

    Up until recently my blog has been displaying fine, as I wanted it, ordering the posts by post_date descending.
    Today (may have been earlier since I don't visit it every day) it started displaying the posts in ascending order by post_date. What happened?

    I have looked everywhere in the Admin login and find no control over how the posts are ordered for display!

    My blog is ourholm.com-slash-blog

  2. There is no explicit control for that sort of thing. Post order is controlled by the theme, more or less.

    So it's not something that's just going to "happen" all by itself. Have you been editing your theme lately? In particular, have you done anything with the query_posts() functions? Look through your theme and see if it calls query_posts anywhere.

    Or perhaps you installed some new plugins, no matter how unrelated they may seem to be to the problem at hand? You never know, with plugins..

    Basically, nothing happens without a reason, so we need to find the trigger that started this problem in order to determine a) why and b) how to fix it.

  3. cfcoder2
    Member
    Posted 7 years ago #

    I have not touched my blog since my last posting made about Thanksgiving time. It was fine then, now it's screwed up. I have installed nor touched any code between that time (that post date and today.) The last plug-in I installed was done maybe 6-9 months ago, the anti-spam one... Akismet.
    That didn't affect it at that time.

    I wonder if the host for my domain did some changes. They indicated recently that they were dropping support for PHP 4.x. They only support PHP 5.x so could that have cause this? They converted any PHP4 sites to PHP5.

  4. cfcoder2
    Member
    Posted 7 years ago #

    BTW... I use the Falling Leaves 0.9 Theme.

  5. cfcoder2
    Member
    Posted 7 years ago #

    Not seeing a solution yet. Anyone have any suggestions? Did going to PHP5 (no PHP4 support on my hosted site) break it?

  6. Kafkaesqui

    Posted 7 years ago #

    "Did going to PHP5 (no PHP4 support on my hosted site) break it?"

    Doubtful. I run WordPress on a couple locales with PHP5 just fine.

    However, when I append the following to your blog's url:

    ?order=DESC

    nothing happens (same with ?orderby=title). This is not what I expect to see if nothing else is going on in the background, either with a plugin or, as Otto noted, through query_posts().

    Can you post up the source of the home page template for your theme (home.php, or if doesn't exist, index.php) here:

    http://wordpress.pastebin.com/

    And reply with the url you get there.

  7. cfcoder2
    Member
    Posted 7 years ago #

    Sorry for the delay, yesterday was pretty busy.
    Here's the URL.

    http://wordpress.pastebin.com/m47622bbd

    Theme is FallingLeaves

  8. moshu
    Member
    Posted 7 years ago #

  9. I don't see anything unusual in the index.php file. Try the header.php file, see if there's something in there that's odd.

    Note: Category archives are in the correct order:
    http://www.ourholm.com/blog/?cat=4
    http://www.ourholm.com/blog/?cat=6

    However, monthly archives are not:
    http://www.ourholm.com/blog/?m=200601

    I'm thinking it must be a plugin or some kind of weird code in functions.php or some other theme files.

    If it was me, I'd run a recursive text search on the whole blog for "ASC" and see what I came up with.

  10. cfcoder2
    Member
    Posted 7 years ago #

    I have posted the header.php here:

    http://wordpress.pastebin.com/m4c3613b9

    How would you suggest I do a resursive search on the blog looking for "ASC"? My site is hosted by a service so I have FTP access.

    The strange thing in all this is that I didn't muck with the blog code in 1-2 yrs now. This change happened recently, like in the last month. I made one new posting since a year ago and that was right after THanksgiving.
    I don't understand why it would get scrambled in any way except for the PHP4 going away. Is this a MySQL mess up? I haven't installed any new plugins in month and months and that was the Aksimet anti-spammer thing but it worked after that anyway.

  11. cfcoder2
    Member
    Posted 7 years ago #

    Looks like moshu's post referencing the exact same issue by someone in the UK may be the ticket... upgrade the blog. Ughh.

  12. alexmk
    Member
    Posted 7 years ago #

    A have the exact same problem at mr-x.dk

    Happened a week ago - using WP 1.5 - Haven't touched a piece of code or plugins for 6 months.

    I made a post and afterwards all posts were reversed.

  13. mxrider108
    Member
    Posted 7 years ago #

    I am having the same problem, and I likewise did not modify any code. After doing some diagnostics I have discovered that changing ?order to DESC does nothing, and the issue is only with query_posts. Alexmk, I notice by your site that you fixed the problem: How?? Please, any help would be great!

  14. alexmk
    Member
    Posted 7 years ago #

    I upgraded to latest version of WP and the problem was fixed.

    I've always thought that upgrading from WP 1.5 would be a pain but it turned out to be quite easy - just 45 minutes (and I made 3 different backups to make sure that I could restore the old site)

    But I think that the problem of this thread is quite weird. I believe that thousands of WP-users have had this problem (I actually met a guy on the street the other day with the same problem). Someone must be able to explain what's wrong with old versions of WP.

    (How do I mark this thread "solved" ?

  15. mxrider108
    Member
    Posted 7 years ago #

    Thanks for the replay, alexmk, but upgrading did *not* fix the problem for me (I am running the newest version), so I am still looking for a solution. Please do not mark the thread solved.

  16. Landscaper
    Member
    Posted 7 years ago #

    This is what happens to me today ! I did the last post on the 2nd, January, and today the order was reverse. There were no changes in the Theme or code for ages ? I´m using WordPress 2.0

  17. Landscaper
    Member
    Posted 7 years ago #

    ... I found this Plugin which fixed the problem on my blog:

    <?php
    /*
    Plugin Name: 123 No Group By ID
    Plugin URI:
    Description: Changes the GROUP BY id in GROUP BY post_date (Problem from MySQL 5.0.51).
    Author: Ingo Henze
    Version: 0.10
    Author URI: http://putzlowitsch.de/
    */ 
    
        // GROUP BY auswerten
        function plw123ngb_posts_groupby( $groupby ) {
            if( preg_match( "/(|[ ,.])id(|[ ,])/i", $groupby ) )
                $groupby = 'post_date';
            return $groupby;
        }
    
        add_filter( 'posts_groupby', 'plw123ngb_posts_groupby' );
    
    ?>
  18. MichaelH
    Member
    Posted 7 years ago #

    To follow up on this, there was a report that this problem is caused when hosts upgrade to MySQL version 5.0.51. The problem, a MySQL bug, is fixed in MySQL 5.0.52.

    For more info see Peter Westwood's post on wp-hackers:
    http://comox.textdrive.com/pipermail/wp-hackers/2008-January/017200.html

Topic Closed

This topic has been closed to new replies.

About this Topic