Sort competitions, seasons, venues, positions, and jobs by slug
This commit is contained in:
@@ -78,7 +78,7 @@ if ( ! function_exists( 'sp_config_types' ) ) {
|
||||
*/
|
||||
if ( ! function_exists( 'sp_taxonomies' ) ) {
|
||||
function sp_taxonomies() {
|
||||
return apply_filters( 'sportspress_taxonomies', array( 'sp_league', 'sp_season', 'sp_venue', 'sp_position' ) );
|
||||
return apply_filters( 'sportspress_taxonomies', array( 'sp_league', 'sp_season', 'sp_venue', 'sp_position', 'sp_role' ) );
|
||||
}
|
||||
}
|
||||
|
||||
@@ -138,6 +138,24 @@ if ( ! function_exists( 'is_sp_config_type' ) ) {
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* is_sp_taxonomy - Returns true if post is SportsPress taxonomy
|
||||
*
|
||||
* @access public
|
||||
* @return bool
|
||||
*/
|
||||
if ( ! function_exists( 'is_sp_taxonomy' ) ) {
|
||||
function is_sp_taxonomy( $typenow = null ) {
|
||||
if ( $typenow == null ) global $typenow;
|
||||
|
||||
$taxonomies = sp_taxonomies();
|
||||
|
||||
if ( in_array( $typenow, $taxonomies ) )
|
||||
return true;
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
if ( ! function_exists( 'is_ajax' ) ) {
|
||||
|
||||
/**
|
||||
|
||||
@@ -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 );
|
||||
|
||||
|
||||
Reference in New Issue
Block a user