I just looked at the source to wp_get_archives(), and apparently postbypost ignores order:
} elseif ( ( ‘postbypost’ == $r[‘type’] ) || (‘alpha’ == $r[‘type’] ) ) {
$orderby = ( ‘alpha’ == $r[‘type’] ) ? ‘post_title ASC ‘ : ‘post_date DESC, ID DESC ‘;
$query = “SELECT * FROM $wpdb->posts $join $where ORDER BY $orderby $limit”;
I wonder if the WordPress maintainers would consider a patch like this to wp_get_archives:
.../wp-includes % diff -c general-template.php general-template.php-PATCHED
*** general-template.php Thu Dec 13 03:56:14 2018
--- general-template.php-PATCHED Wed Dec 19 10:10:24 2018
***************
*** 1873,1878 ****
--- 1873,1879 ----
wp_cache_set( $key, $results, 'posts' );
}
if ( $results ) {
+ if ( $order == 'ASC' ) $results = array_reverse( $results );
foreach ( (array) $results as $result ) {
if ( $result->post_date != '0000-00-00 00:00:00' ) {
$url = get_permalink( $result );
-
This reply was modified 7 years, 3 months ago by
pmcjones.
-
This reply was modified 7 years, 3 months ago by
pmcjones.
It turns out the Annual Archive plugin (https://wordpress.org/plugins/anual-archive/) implements a post_order parameter that works with postbypost. So this shortcode solved my problem:
[archives type=’postbypost’ post_order=’asc’]