Support » Fixing WordPress » Sorted wp_get_archives

  • Gentleman, how would you go about sorting the output of wp_get_archives alphabetically?

    I am talking about postbypost type of wp_get_archives and perhaps limit of 100 latest entries.

Viewing 1 replies (of 1 total)
  • I’d rewrite the get_archives function, since the sort column is hardcoded. The function is found around line 260 (1.5) in:

    wp-includes/template-functions-general.php

    In the file look for this elseif:

    } elseif ('postbypost' == $type) {

    Change the $arcresults SELECT line at the end from:

    ORDER BY post_date DESC" . $limit);

    to:

    ORDER BY post_title ASC" . $limit);

    Practice good hacking by backing up core WordPress files before editing them, and comment your changes.

Viewing 1 replies (of 1 total)
  • The topic ‘Sorted wp_get_archives’ is closed to new replies.