Forums

Latest post to Oldest Post (3 posts)

  1. sainait
    Member
    Posted 5 years ago #

    Formally, WordPress shows latest posts in home page. I need to show oldest posts. Please Help. In my opinion, i should edit query which may be "SELECT... SORT BY post_date DESC LIMIT 10" to "SELECT ... SORT BY post_date ASC LIMIT 10 ". But i did not find. And i don't understand get_the_content function, where it passes argument (how many post to show) from and to.

    Please advice, and thank you.

  2. Otto
    Tech Ninja
    Posted 5 years ago #

    In 2.1.x, look at wp-includes/query.php, around about line 890. This code:

    if ((empty($q['order'])) || ((strtoupper($q['order']) != 'ASC') && (strtoupper($q['order']) != 'DESC'))) {
    			$q['order']='DESC';
    		}

    That's where it sets the default order of DESC if no order is specified exactly. Change it to this:

    if ((empty($q['order'])) || ((strtoupper($q['order']) != 'ASC') && (strtoupper($q['order']) != 'DESC'))) {
    			$q['order']='ASC';
    		}

    And it's reversed, by default.

    If you're still using 2.0.x, then it'll be the same code, but in classes.php, around line 565 or so.

  3. sainait
    Member
    Posted 5 years ago #

    thanks. It works. Thank You Very Much.

Topic Closed

This topic has been closed to new replies.

About this Topic

Tags

No tags yet.