Sort competitions, seasons, venues, positions, and jobs by slug

This commit is contained in:
Brian Miyaji
2016-04-13 17:07:38 +10:00
parent c808012201
commit 07235517e1
2 changed files with 33 additions and 1 deletions

View File

@@ -289,6 +289,20 @@ function sportspress_no_terms_links( $term_list, $taxonomy ) {
}
add_filter( 'the_terms', 'sportspress_no_terms_links', 10, 2 );
function sportspress_strcmp_term_slug( $a, $b ) {
return strcmp( $a->slug, $b->slug );
}
function sportspress_term_order( $terms, $post_id, $taxonomy ) {
if ( is_sp_taxonomy( $taxonomy ) ) {
uasort( $terms, 'sportspress_strcmp_term_slug' );
}
return $terms;
}
add_filter( 'get_the_terms', 'sportspress_term_order', 10, 3 );
function sportspress_pre_get_posts( $query ) {
$post_type = sp_array_value( $query->query, 'post_type', null );