Last active
May 24, 2016 03:48
-
-
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/
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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