Created
February 12, 2019 09:49
-
-
Save yousufansa/68c521c6e1257cc7185e9fa1c7ff658a to your computer and use it in GitHub Desktop.
Bethlehem - Change Team Members Order
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
if( ! function_exists( 'bethlehem_child_pre_get_posts' ) ) { | |
function bethlehem_child_pre_get_posts( $query ) { | |
if ( $query->is_post_type_archive( 'team-member' ) || $query->is_tax( get_object_taxonomies( 'team-member' ) ) ) { | |
if( ! isset( $query->query_vars['orderby'] ) ) { | |
$query->set( 'orderby', apply_filters( 'team_members_orderby', 'date' ) ); | |
} | |
if( ! isset( $query->query_vars['order'] ) ) { | |
$query->set( 'order', apply_filters( 'team_members_order', 'DESC' ) ); | |
} | |
} | |
return $query; | |
} | |
} | |
add_filter( 'pre_get_posts', 'bethlehem_child_pre_get_posts' ); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment