Skip to content

Instantly share code, notes, and snippets.

@joeydsmith
Created April 3, 2015 18:03
Show Gist options
  • Save joeydsmith/252f19a2668e1b344e72 to your computer and use it in GitHub Desktop.
Save joeydsmith/252f19a2668e1b344e72 to your computer and use it in GitHub Desktop.
<?php
add_action( 'pre_get_posts', 'custom_get_posts' );
function custom_get_posts( $query ) {
if( (is_category() || is_archive()) && $query->is_main_query() ) {
if ( $query->query_vars['post_type'] == 'staff' || $query->query_vars['post_type'] == 'stories' ) {
$query->query_vars['orderby'] = 'menu_order';
$query->query_vars['order'] = 'ASC';
}
if ($query->query_vars['post_type'] == 'advisory_council') {
$query->query_vars['orderby'] = 'title';
$query->query_vars['order'] = 'ASC';
}
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment