Support » Fixing WordPress » Sorting blog posts

  • Resolved andersdrengen

    (@andersdrengen)


    Hi,

    For some weird reason all my blog posts 200+ are now sorted reverse when I enter my page. I’ve done nothing (really!) as I’ve been offline for a period of time.

    Anyway, when looking at the blog main page it says “blablabla, posted 2 years and 10 months ago” – when scrolling to the ‘last’ page it shows my newest post, a few days ago.

    Can somebody point me to something that can reverse the posts? Everything works fine…

    Thanks a lot!

Viewing 3 replies - 1 through 3 (of 3 total)
  • Thread Starter andersdrengen

    (@andersdrengen)

    Got this one myself, so it’s solved now – it’s due to a problem/error in MySQL v. 5.0.51 that creates this behaviour. Upgrading to 5.0.52 resolves this. If that’s not possible, I found this piece of code that can be used instead as plugin…

    <?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’ );
    ?>

    where do I insert these codes?

    Missylovely: I am having the same problem and this code fixed it for me. My categories page show the correct post order (Descending) but the main page is in Ascending order.

    Go into your admin control panel. Go to PRESENTATION > Theme Editor. Find the home page file for your theme. Usually this file is the index.php or home.php file.

    I would copy and paste the above code and add it after the <?php get_header(); ?> line

Viewing 3 replies - 1 through 3 (of 3 total)
  • The topic ‘Sorting blog posts’ is closed to new replies.