Created
October 8, 2012 21:02
-
-
Save rodgerthat/3854960 to your computer and use it in GitHub Desktop.
Change / Modify Default WordPress Query from functions.php using pre_get_posts
This file contains hidden or 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
/* | |
* Mod Default Query | |
* | |
* get at the default query and make your changes before the template ( or whatever is run ) | |
* | |
*/ | |
function ahso_default_query_mods( $query ) { | |
// use conditional tags | |
if ( is_tax('work_cat') ) { | |
// once you've got the query_vars, limit == sky. | |
$query->query_vars['order'] = 'ASC'; | |
$query->query_vars['orderby'] = 'menu_order'; | |
} | |
} | |
add_action( 'pre_get_posts', 'ahso_default_query_mods' ); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment