Dec
31

How to set Archives list in Ascending order?

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.

Popularity: 5%

Related posts:
  1. Code To Display Archives In Drop Down Format In WordPress Blog Hi, You can use this code to display Archives in...
  2. Moo Collapsing Archives Plugin For WordPress Hi, This plugin is developed using JScript. It is based...
  3. Archives Shortcode: WordPress.com Feature There is a good news for wordpress.com users. WordPress has...
  4. Code To Display Archives At WordPress Blog Hello All, In order to display archives at wordpress blog...
  5. Code To Display Archives In A Drop Down Menu At WordPress Blog Hello All, In order to display archives In Drop Down...

Leave a Reply

You must be logged in to post a comment.