diff --git a/includes/admin/post-types/meta-boxes/class-sp-meta-box-player-statistics.php b/includes/admin/post-types/meta-boxes/class-sp-meta-box-player-statistics.php index 036d148b..329ba652 100644 --- a/includes/admin/post-types/meta-boxes/class-sp-meta-box-player-statistics.php +++ b/includes/admin/post-types/meta-boxes/class-sp-meta-box-player-statistics.php @@ -23,6 +23,7 @@ class SP_Meta_Box_Player_Statistics { $leagues = get_the_terms( $post->ID, '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; if ( $leagues ) { if ( -1 == $sections ) { @@ -36,11 +37,13 @@ class SP_Meta_Box_Player_Statistics { self::table( $post->ID, $league->term_id, $columns, $data, $placeholders, $merged, $seasons_teams, $has_checkboxes && $i == 0, true, $formats ); $i ++; endforeach; - ?> -
- data( 0, true ); - self::table( $post->ID, 0, $columns, $data, $placeholders, $merged, $seasons_teams ); + if ( $show_career_totals ) { + ?> +
+ data( 0, true ); + self::table( $post->ID, 0, $columns, $data, $placeholders, $merged, $seasons_teams ); + } } else { // Determine order of sections if ( 1 == $sections ) { @@ -61,11 +64,13 @@ class SP_Meta_Box_Player_Statistics { self::table( $post->ID, $league->term_id, $columns, $data, $placeholders, $merged, $seasons_teams, $has_checkboxes && $i == 0 && $s == 0, $s == 0 ); $i ++; endforeach; - ?> -
—
- data( 0, true, $section_id ); - self::table( $post->ID, 0, $columns, $data, $placeholders, $merged, $seasons_teams, $has_checkboxes && $i == 0 && $s == 0, $s == 0 ); + if ( $show_career_totals ) { + ?> +—
+ data( 0, true, $section_id ); + self::table( $post->ID, 0, $columns, $data, $placeholders, $merged, $seasons_teams, $has_checkboxes && $i == 0 && $s == 0, $s == 0 ); + } $s ++; } } diff --git a/includes/admin/settings/class-sp-settings-players.php b/includes/admin/settings/class-sp-settings-players.php index 22c1f0a5..14b2abc8 100644 --- a/includes/admin/settings/class-sp-settings-players.php +++ b/includes/admin/settings/class-sp-settings-players.php @@ -122,6 +122,22 @@ class SP_Settings_Players extends SP_Settings_Page { 'checkboxgroup' => 'end', ), + array( + 'title' => __( 'Nationality', 'sportspress' ), + 'desc' => __( 'Display national flags', 'sportspress' ), + 'id' => 'sportspress_player_show_flags', + 'default' => 'yes', + 'type' => 'checkbox', + ), + ) ), + + array( + array( 'type' => 'sectionend', 'id' => 'player_options' ), + ), + + array( + array( 'title' => __( 'Statistics', 'sportspress' ), 'type' => 'title','desc' => '', 'id' => 'player_statistic_options' ), + array( 'title' => __( 'Columns', 'sportspress' ), 'id' => 'sportspress_player_columns', @@ -134,7 +150,7 @@ class SP_Settings_Players extends SP_Settings_Page { ), array( - 'title' => __( 'Statistics', 'sportspress' ), + 'title' => __( 'Categories', 'sportspress' ), 'id' => 'sportspress_player_performance_sections', 'default' => -1, 'type' => 'radio', @@ -146,24 +162,28 @@ class SP_Settings_Players extends SP_Settings_Page { ), array( - 'title' => __( 'Total', 'sportspress' ), - 'desc' => __( 'Display total', 'sportspress' ), + 'title' => __( 'Display', 'sportspress' ), + 'desc' => __( 'Total', 'sportspress' ), 'id' => 'sportspress_player_show_total', 'default' => 'no', 'type' => 'checkbox', + 'checkboxgroup' => 'start', ), array( - 'title' => __( 'Nationality', 'sportspress' ), - 'desc' => __( 'Display national flags', 'sportspress' ), - 'id' => 'sportspress_player_show_flags', - 'default' => 'yes', + 'desc' => __( 'Career Total', 'sportspress' ), + 'id' => 'sportspress_player_show_career_total', + 'default' => 'no', 'type' => 'checkbox', + 'checkboxgroup' => 'end', ), + ), + + apply_filters( 'sportspress_player_statistic_options', array( ) ), array( - array( 'type' => 'sectionend', 'id' => 'player_options' ), + array( 'type' => 'sectionend', 'id' => 'player_statistic_options' ), ) ); diff --git a/includes/class-sp-install.php b/includes/class-sp-install.php index 716f15dc..05aa7184 100644 --- a/includes/class-sp-install.php +++ b/includes/class-sp-install.php @@ -429,6 +429,11 @@ class SP_Install { update_option( 'sportspress_event_show_timeline', 'no' ); update_option( 'sportspress_event_logos_show_team_names', 'no' ); } + + if ( version_compare( $version, '2.2.3', '<' ) ) { + $option = get_option( 'sportspress_player_show_total', 'no' ); + update_option( 'sportspress_player_show_career_total', $option ); + } } /** diff --git a/templates/player-statistics.php b/templates/player-statistics.php index 1eb9bbc4..62c152ec 100644 --- a/templates/player-statistics.php +++ b/templates/player-statistics.php @@ -16,6 +16,7 @@ if ( ! isset( $id ) ) $player = new SP_Player( $id ); $scrollable = get_option( 'sportspress_enable_scrollable_tables', 'yes' ) == 'yes' ? true : false; +$show_career_totals = 'yes' === get_option( 'sportspress_player_show_career_total', 'no' ) ? true : false; $sections = get_option( 'sportspress_player_performance_sections', -1 ); $show_teams = apply_filters( 'sportspress_player_team_statistics', true ); $leagues = get_the_terms( $id, 'sp_league' ); @@ -65,11 +66,13 @@ if ( is_array( $leagues ) ): sp_get_template( 'player-statistics-league.php', $args ); endforeach; - sp_get_template( 'player-statistics-league.php', array( - 'data' => $player->data( 0, false, $section_id ), - 'caption' => __( 'Career Total', 'sportspress' ), - 'scrollable' => $scrollable, - 'hide_teams' => true, - ) ); + if ( $show_career_totals ) { + sp_get_template( 'player-statistics-league.php', array( + 'data' => $player->data( 0, false, $section_id ), + 'caption' => __( 'Career Total', 'sportspress' ), + 'scrollable' => $scrollable, + 'hide_teams' => true, + ) ); + } } endif; \ No newline at end of file