How to set Archives list in Ascending order?

Posted by

By default, the archives are set to descending order. But you can change it to ascending order using below mentioned steps:

1)     Go to your wordpress directory.

2)     Open the file wp-includes/general-template.php.

3)     Look for the function wp_get_archives. In this function, you will find this code:

if ( ‘monthly’ == $type ) {

$query = “SELECT DISTINCT YEAR(post_date) AS ‘year’, MONTH(post_date) AS ‘month’, count(ID) as posts FROM $wpdb->posts $join $where GROUP BY YEAR(post_date), MONTH(post_date) ORDER BY post_date DESC $limit”;

4)     Change the value DESC to ASC and save the template.

5)     Your archives will be displayed in ascending order now.

6)     If you are using yearly archives, please select the appropriate code from the template.

Ryan S.

Leave a Reply

This site uses Akismet to reduce spam. Learn how your comment data is processed.