WordPress.org

Ready to get started?Download WordPress

Forums

Sorted wp_get_archives (2 posts)

  1. prostoalex
    Member
    Posted 9 years ago #

    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.

  2. Kafkaesqui

    Posted 9 years ago #

    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.

Topic Closed

This topic has been closed to new replies.

About this Topic