Skip to content

Instantly share code, notes, and snippets.

@bradpotter
Created April 23, 2015 18:54
Show Gist options
  • Save bradpotter/9084667a8ec826ec9dd6 to your computer and use it in GitHub Desktop.
Save bradpotter/9084667a8ec826ec9dd6 to your computer and use it in GitHub Desktop.
Modify the main query based on tag
//* Modify the main query based on tag
add_action( 'pre_get_posts','custom_tax_query' );
function custom_tax_query( $query ) {
if ( $query->is_main_query() && $query->is_tag( 'west-valley-2015' ) ) {
$query->set( 'posts_per_page', '3' );
$query->set( 'order', 'ASC' );
$query->set( 'orderby', 'title' );
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment