Merge pull request #272 from kadimi/patch-8

Sort leagues, positions and season by sp_order
This commit is contained in:
Brian Miyaji
2018-07-09 16:00:12 +10:00
committed by GitHub
4 changed files with 47 additions and 37 deletions

View File

@@ -5,7 +5,7 @@
* @author ThemeBoy
* @category Admin
* @package SportsPress/Admin/Meta_Boxes
* @version 2.6
* @version 2.6.5
*/
if ( ! defined( 'ABSPATH' ) ) exit; // Exit if accessed directly
@@ -20,20 +20,7 @@ class SP_Meta_Box_Player_Statistics {
*/
public static function output( $post ) {
$player = new SP_Player( $post );
$args = array(
'meta_query' => array(
'relation' => 'OR',
array(
'key' => 'sp_order',
'compare' => 'NOT EXISTS',
),
array(
'key' => 'sp_order',
'compare' => 'EXISTS',
),
),
);
$leagues = get_the_terms( $post->ID, 'sp_league', $args );
$leagues = $player->get_terms_sorted_by_sp_order( 'sp_league' );
$league_num = sizeof( $leagues );
$sections = get_option( 'sportspress_player_performance_sections', -1 );
$show_career_totals = 'yes' === get_option( 'sportspress_player_show_career_total', 'no' ) ? true : false;