Created
June 26, 2012 13:21
-
-
Save pdewouters/2995754 to your computer and use it in GitHub Desktop.
change post order on post type archive / taxonomy archive
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', 'child_sort_post_order' ); | |
function child_sort_post_order( $query ) { | |
if ( is_post_type_archive('my_post_type') || is_tax() ){ | |
$query->query_vars['orderby'] = 'title'; | |
$query->query_vars['order'] = 'asc'; | |
return; | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment