Skip to content

Instantly share code, notes, and snippets.

@srikat

srikat/functions.php

Last active May 24, 2016
Embed
What would you like to do?
How to show books in ascending order of published date when using Genesis Author Pro plugin. https://sridharkatakam.com/show-series-tags-books-library-using-genesis-author-pro-plugin/
add_action( 'pre_get_posts', 'sk_change_books_order' );
/**
* Change display order of books on the archive from DESC to ASC
*
* @author Bill Erickson
* @link http://www.billerickson.net/customize-the-wordpress-query/
* @param object $query data
*
*/
function sk_change_books_order( $query ) {
if( $query->is_main_query() && !is_admin() && is_post_type_archive( 'books' ) ) {
$query->set( 'order', 'ASC' );
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.