Skip to content

Instantly share code, notes, and snippets.

@srikat
Last active May 24, 2016 03:48
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save srikat/bac76dd17720b97ec97e1156c1890dbc to your computer and use it in GitHub Desktop.
Save srikat/bac76dd17720b97ec97e1156c1890dbc to your computer and use it in GitHub Desktop.
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