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. How To Display Most Commented Posts In Wordpress Blog Hi, Please use this code to display the posts that...
  2. How To Limit Display Of Archive Months In Wordpress Hi, Most of the wordpress themes are with standard code...
  3. Code To Display Archives In Drop Down Format In Wordpress Blog Hi, You can use this code to display Archives in...
  4. How To Display Popular Post In Wordpress Blog Hi, Sidebar is a very good element of the blog...
  5. How To Find List Of Registered User In WordPress Blog? Hello All, In order to find a list of total...

Leave a Reply

You must be logged in to post a comment.