diff --git a/assets/css/icons.css b/assets/css/icons.css
new file mode 100644
index 00000000..21b8c9e6
--- /dev/null
+++ b/assets/css/icons.css
@@ -0,0 +1,50 @@
+/* SportsPress icons */
+@font-face {
+ font-family: 'sportspress';
+ src:url('../fonts/sportspress.eot?-76nsup');
+ src:url('../fonts/sportspress.eot?#iefix-76nsup') format('embedded-opentype'),
+ url('../fonts/sportspress.woff2?-76nsup') format('woff2'),
+ url('../fonts/sportspress.ttf?-76nsup') format('truetype'),
+ url('../fonts/sportspress.woff?-76nsup') format('woff'),
+ url('../fonts/sportspress.svg?-76nsup#sportspress') format('svg');
+ font-weight: normal;
+ font-style: normal;
+}
+
+[class^="sp-icon-"], [class*=" sp-icon-"] {
+ font-family: sportspress, dashicons;
+ speak: none;
+ font-style: normal;
+ font-weight: normal;
+ font-variant: normal;
+ text-transform: none;
+ line-height: 1;
+ display: inline-block;
+ width: 20px;
+ height: 20px;
+ font-size: 20px;
+ vertical-align: top;
+
+ /* Better Font Rendering =========== */
+ -webkit-font-smoothing: antialiased;
+ -moz-osx-font-smoothing: grayscale;
+}
+
+.sp-icon-baseball:before {
+ content: "\e701";
+}
+.sp-icon-basketball:before {
+ content: "\e602";
+}
+.sp-icon-cricketball:before {
+ content: "\e604";
+}
+.sp-icon-soccerball:before {
+ content: "\e700";
+}
+.sp-icon-shoe:before {
+ content: "\e800";
+}
+.sp-icon-card:before {
+ content: "\e801";
+}
\ No newline at end of file
diff --git a/assets/css/menu.css b/assets/css/menu.css
index bab481f5..8ef39c8b 100644
--- a/assets/css/menu.css
+++ b/assets/css/menu.css
@@ -1,12 +1,12 @@
/* SportsPress menu styles */
@font-face {
font-family: 'sportspress';
- src:url('../fonts/sportspress.eot?gvy36n');
- src:url('../fonts/sportspress.eot?#iefixgvy36n') format('embedded-opentype'),
- url('../fonts/sportspress.woff2?gvy36n') format('woff2'),
- url('../fonts/sportspress.ttf?gvy36n') format('truetype'),
- url('../fonts/sportspress.woff?gvy36n') format('woff'),
- url('../fonts/sportspress.svg?gvy36n#sportspress') format('svg');
+ src:url('../fonts/sportspress.eot?-76nsup');
+ src:url('../fonts/sportspress.eot?#iefix-76nsup') format('embedded-opentype'),
+ url('../fonts/sportspress.woff2?-76nsup') format('woff2'),
+ url('../fonts/sportspress.ttf?-76nsup') format('truetype'),
+ url('../fonts/sportspress.woff?-76nsup') format('woff'),
+ url('../fonts/sportspress.svg?-76nsup#sportspress') format('svg');
font-weight: normal;
font-style: normal;
}
@@ -138,6 +138,27 @@
.sp-icon-whistle:before {
content: "\f227";
}
+.sp-icon-baseball:before {
+ content: "\e701";
+}
+.sp-icon-basketball:before {
+ content: "\e602";
+}
+.sp-icon-golfball:before {
+ content: "\e603";
+}
+.sp-icon-cricketball:before {
+ content: "\e604";
+}
+.sp-icon-soccerball:before {
+ content: "\e700";
+}
+.sp-icon-shoe:before {
+ content: "\e800";
+}
+.sp-icon-card:before {
+ content: "\e801";
+}
#adminmenu #toplevel_page_sportspress .toplevel_page_sportspress div.wp-menu-image:before,
#adminmenu #toplevel_page_themeboy .toplevel_page_themeboy div.wp-menu-image:before,
@@ -202,6 +223,30 @@
color: #ccc;
}
+/* Icons */
+.sp-icons .button {
+ margin: 0 3px 4px 0;
+ padding: 0 7px 1px 5px;
+}
+
+.sp-icons .button i {
+ margin: 3px 0;
+}
+
+.sp-icon-color-box input[type=text] {
+ color: #fff;
+}
+
+.wp-admin .sp-icons label input[type=radio] {
+ margin-top: -3px;
+}
+
+@media screen and (max-width: 782px) {
+ .wp-admin .sp-icons label input[type=radio] {
+ margin-top: 1px;
+ }
+}
+
/* TinyMCE */
.mce-toolbar i.mce-i-sp_shortcodes_button, .mce-toolbar span.mce_sp_shortcodes_button {
margin-right: -5px;
diff --git a/assets/fonts/sportspress.eot b/assets/fonts/sportspress.eot
index 9a009bb5..907eb16b 100755
Binary files a/assets/fonts/sportspress.eot and b/assets/fonts/sportspress.eot differ
diff --git a/assets/fonts/sportspress.svg b/assets/fonts/sportspress.svg
index 6463385d..129f688b 100755
--- a/assets/fonts/sportspress.svg
+++ b/assets/fonts/sportspress.svg
@@ -7,6 +7,15 @@
+
+
+
+
+
+
+
+
+
diff --git a/assets/fonts/sportspress.ttf b/assets/fonts/sportspress.ttf
index b9239a94..3e1948e4 100755
Binary files a/assets/fonts/sportspress.ttf and b/assets/fonts/sportspress.ttf differ
diff --git a/assets/fonts/sportspress.woff b/assets/fonts/sportspress.woff
index 21f4ebd1..34993baf 100755
Binary files a/assets/fonts/sportspress.woff and b/assets/fonts/sportspress.woff differ
diff --git a/assets/fonts/sportspress.woff2 b/assets/fonts/sportspress.woff2
index 75a8e3e9..2bb9e6f8 100755
Binary files a/assets/fonts/sportspress.woff2 and b/assets/fonts/sportspress.woff2 differ
diff --git a/assets/js/admin/iconpicker.js b/assets/js/admin/iconpicker.js
new file mode 100644
index 00000000..04f99c60
--- /dev/null
+++ b/assets/js/admin/iconpicker.js
@@ -0,0 +1,37 @@
+jQuery(document).ready(function($){
+
+ // Icon picker
+ $('.sp-icons input').on('change', function() {
+ if ('' == $(this).val()) {
+ $('.sp-custom-colors').hide();
+ $('.sp-custom-thumbnail').show();
+ } else {
+ $('.sp-custom-thumbnail').hide();
+ $('.sp-custom-colors').show();
+ }
+ });
+
+ // Color picker
+ $('.colorpick').iris( {
+ change: function(event, ui){
+ $(this).css( { backgroundColor: ui.color.toString() } );
+ },
+ hide: true,
+ border: true
+ } ).each( function() {
+ $(this).css( { backgroundColor: $(this).val() } );
+ })
+ .click(function(){
+ $('.iris-picker').hide();
+ $(this).closest('.sp-icon-color-box, td').find('.iris-picker').show();
+ });
+
+ $('body').click(function() {
+ $('.iris-picker').hide();
+ });
+
+ $('.sp-icon-color-box, .colorpick').click(function(event){
+ event.stopPropagation();
+ });
+
+});
\ No newline at end of file
diff --git a/includes/admin/class-sp-admin-sports.php b/includes/admin/class-sp-admin-sports.php
index 5ebe716e..647d3f04 100644
--- a/includes/admin/class-sp-admin-sports.php
+++ b/includes/admin/class-sp-admin-sports.php
@@ -47,6 +47,16 @@ class SP_Admin_Sports {
$id = preg_replace('/\\.[^.\\s]{3,4}$/', '', $file );
$presets[ $id ] = $data;
$name = array_key_exists( 'name', $data ) ? __( $data['name'], 'sportspress' ) : $id;
+
+ // Conditionally append filename in parentheses for clarity
+ if ( false === strpos( str_replace( ' ', '', strtolower( $data['name'] ) ), str_replace( '-', '', $id ) ) ) {
+ if ( 4 < strlen( $id ) ) {
+ $name .= ' (' . ucfirst( $id ) . ')';
+ } else {
+ $name .= ' (' . strtoupper( $id ) . ')';
+ }
+ }
+
self::$options[ $slug ][ $id ] = $name;
}
asort( self::$options[ $slug ] );
@@ -153,6 +163,8 @@ class SP_Admin_Sports {
if ( isset( $performance['position'] ) ) {
wp_set_object_terms( $id, $performance['position'], 'sp_position', false );
}
+ update_post_meta( $id, 'sp_icon', sp_array_value( $performance, 'icon', null ) );
+ update_post_meta( $id, 'sp_color', sp_array_value( $performance, 'color', null ) );
$i ++;
}
diff --git a/includes/admin/views/html-admin-config.php b/includes/admin/views/html-admin-config.php
index 81dec039..52d3bdea 100644
--- a/includes/admin/views/html-admin-config.php
+++ b/includes/admin/views/html-admin-config.php
@@ -185,9 +185,11 @@
ID ) )
- echo get_the_post_thumbnail( $row->ID, 'sportspress-fit-mini' );
+ $icon = get_the_post_thumbnail( $row->ID, 'sportspress-fit-mini' );
else
- echo ' ';
+ $icon = ' ';
+
+ echo apply_filters( 'sportspress_performance_icon', $icon, $row->ID );
?>
|
post_title; ?> |
diff --git a/license.txt b/license.txt
index d14e3cfa..34aca7e5 100644
--- a/license.txt
+++ b/license.txt
@@ -25,8 +25,9 @@ permission notices:
SportsPress includes icons from WebHostingHub Glyphs, released under the
SIL Open Font License; 80 Shades of White Icons by Victor Erixon; Entypo
and Entypo+ by Daniel Bruce, released under CC BY-SA 3.0; Font Awesome by
- Dave Gancy, released under the GPL. The custom designed icons included in
- SportsPress are released under the GPL.
+ Dave Gancy, released under the GPL; Flaticon by Freepick, released under
+ CC BY 3.0. The custom designed icons included in SportsPress are released
+ under the GPL.
Wherever third party code has been used, credit has been given in the code's
comments.
diff --git a/modules/sportspress-icons.php b/modules/sportspress-icons.php
new file mode 100644
index 00000000..248dda2a
--- /dev/null
+++ b/modules/sportspress-icons.php
@@ -0,0 +1,168 @@
+define_constants();
+
+ // Define icons
+ $this->get_icons();
+
+ add_filter( 'sportspress_enqueue_styles', array( $this, 'add_styles' ) );
+ add_filter( 'sportspress_performance_icon', array( $this, 'icon' ), 10, 2 );
+ add_filter( 'sportspress_event_performance_icons', array( $this, 'replace_icons' ), 10, 3 );
+ add_filter( 'admin_post_thumbnail_html', array( $this, 'admin_post_thumbnail_html' ), 10, 2 );
+ add_action( 'sportspress_process_sp_performance_meta', array( $this, 'save' ), 10, 2 );
+ }
+
+ /**
+ * Define constants.
+ */
+ private function define_constants() {
+ if ( !defined( 'SP_ICONS_VERSION' ) )
+ define( 'SP_ICONS_VERSION', '1.9' );
+
+ if ( !defined( 'SP_ICONS_URL' ) )
+ define( 'SP_ICONS_URL', plugin_dir_url( __FILE__ ) );
+
+ if ( !defined( 'SP_ICONS_DIR' ) )
+ define( 'SP_ICONS_DIR', plugin_dir_path( __FILE__ ) );
+ }
+
+ /**
+ * Add stylesheet.
+ */
+ public static function add_styles( $styles = array() ) {
+ $styles['sportspress-icons'] = array(
+ 'src' => str_replace( array( 'http:', 'https:' ), '', SP()->plugin_url() ) . '/assets/css/icons.css',
+ 'deps' => '',
+ 'version' => SP_ICONS_VERSION,
+ 'media' => 'all'
+ );
+ return $styles;
+ }
+
+ /**
+ * Define icons.
+ */
+ private function get_icons() {
+ $this->icons = apply_filters( 'sportspress_icons', array(
+ 'soccerball',
+ 'baseball',
+ 'basketball',
+ 'cricketball',
+ 'shoe',
+ 'card',
+ ) );
+ }
+
+ /**
+ * Display vector icon.
+ */
+ public function icon( $icon = '', $id = 0 ) {
+ if ( ! $id ) return $icon;
+ $meta = get_post_meta( $id, 'sp_icon', true );
+ if ( null !== $meta && in_array( $meta, $this->icons ) ) {
+ $color = get_post_meta( $id, 'sp_color', true );
+ $icon = '';
+ }
+ return $icon;
+ }
+
+ /**
+ * Replace icons with vectors when available.
+ */
+ public function replace_icons( $icons = '', $id = 0, $value = 0 ) {
+ if ( ! $id || ! $value ) return $icons;
+ $icon = get_post_meta( $id, 'sp_icon', true );
+ if ( null !== $icon && in_array( $icon, $this->icons ) ) {
+ $title = get_the_title( $id );
+ $color = get_post_meta( $id, 'sp_color', true );
+ $icons = str_repeat( '' . ' ', $value );
+ }
+ return $icons;
+ }
+
+ /**
+ * Post thumbnail HTML.
+ */
+ public function admin_post_thumbnail_html( $content = '', $id = 0 ) {
+ // Bypass if no ID
+ if ( ! $id ) return $content;
+
+ // Bypass if not performance post type
+ $post_type = get_post_type( $id );
+ if ( 'sp_performance' !== $post_type ) return $content;
+
+ // Enqueue scripts
+ wp_enqueue_script( 'sp_iconpicker', SP()->plugin_url() . '/assets/js/admin/iconpicker.js', array( 'jquery', 'wp-color-picker', 'iris' ), SP_ICONS_VERSION, true );
+
+ // Get selected icon
+ $has_icon = has_post_thumbnail( $id );
+ $selected = get_post_meta( $id, 'sp_icon', true );
+ if ( $has_icon ) $selected = null;
+
+ // Generate icon selector
+ $icons = '';
+ foreach ( $this->icons as $icon ) {
+ $icons .= '';
+ }
+
+ $icons .= '';
+
+ // Get color value
+ $value = get_post_meta( $id, 'sp_color', true );
+ if ( empty( $value ) ) $value = '111111';
+
+ $color = '';
+
+ $content = '' . __( 'Select Icon', 'sportspress' ) . '
+ ' . $icons . '
+ ' . $color . '
+ ' . $content . '
';
+ return $content;
+ }
+
+ /**
+ * Save meta boxes data
+ */
+ public static function save( $post_id, $post ) {
+ update_post_meta( $post_id, 'sp_icon', sp_array_value( $_POST, 'sp_icon', null ) );
+ update_post_meta( $post_id, 'sp_color', sp_array_value( $_POST, 'sp_color', null ) );
+ if ( null != sp_array_value( $_POST, 'sp_icon', null ) ) {
+ delete_post_thumbnail( $post );
+ }
+ }
+}
+
+endif;
+
+new SportsPress_Icons();
\ No newline at end of file
diff --git a/templates/event-logos.php b/templates/event-logos.php
index b9cb4585..d53d772d 100644
--- a/templates/event-logos.php
+++ b/templates/event-logos.php
@@ -32,9 +32,11 @@ if ( $teams ):
if ( ! has_post_thumbnail( $team ) ) continue;
$logo = get_the_post_thumbnail( $team, 'sportspress-fit-icon' );
+ $alt = sizeof( $teams ) == 2 && $i % 2;
+
// Add team name
if ( $show_team_names ) {
- if ( $i % 2 ) {
+ if ( $alt ) {
$logo .= ' ' . get_the_title( $team ) . '';
} else {
$logo = '' . get_the_title( $team ) . ' ' . $logo;
@@ -46,7 +48,7 @@ if ( $teams ):
// Add result
if ( $show_results ) {
- if ( $i % 2 ) {
+ if ( $alt ) {
$logo = '' . array_shift( $results ) . ' ' . $logo;
} else {
$logo .= ' ' . array_shift( $results ) . '';
@@ -58,7 +60,7 @@ if ( $teams ):
endforeach;
$team_logos = array_filter( $team_logos );
if ( ! empty( $team_logos ) ):
- echo '';
+ echo '
';
$delimiter = get_option( 'sportspress_event_teams_delimiter', 'vs' );
echo implode( ' ' . $delimiter . ' ', $team_logos );
echo '
';
diff --git a/templates/event-performance-table-combined.php b/templates/event-performance-table-combined.php
index 8d543cae..f0ca5297 100644
--- a/templates/event-performance-table-combined.php
+++ b/templates/event-performance-table-combined.php
@@ -12,7 +12,7 @@ if ( ! defined( 'ABSPATH' ) ) exit; // Exit if accessed directly
// Initialize totals
$totals = array();
?>
-
+
@@ -94,9 +94,11 @@ $totals = array();
echo '
' . $value . ' | ';
elseif ( intval( $value ) && $mode == 'icons' ):
$performance_id = sp_array_value( $performance_ids, $key, null );
+ $icons = '';
if ( $performance_id && has_post_thumbnail( $performance_id ) ):
- echo str_repeat( get_the_post_thumbnail( $performance_id, 'sportspress-fit-mini' ) . ' ', $value );
+ $icons = str_repeat( get_the_post_thumbnail( $performance_id, 'sportspress-fit-mini' ) . ' ', $value );
endif;
+ echo apply_filters( 'sportspress_event_performance_icons', $icons, $performance_id, $value );
endif;
endforeach;
@@ -142,9 +144,11 @@ $totals = array();
echo '
' . $value . ' | ';
elseif ( intval( $value ) && $mode == 'icons' ):
$performance_id = sp_array_value( $performance_ids, $key, null );
+ $icons = '';
if ( $performance_id && has_post_thumbnail( $performance_id ) ):
- echo str_repeat( get_the_post_thumbnail( $performance_id, 'sportspress-fit-mini' ) . ' ', $value );
+ $icons = str_repeat( get_the_post_thumbnail( $performance_id, 'sportspress-fit-mini' ) . ' ', $value );
endif;
+ echo apply_filters( 'sportspress_event_performance_icons', $icons, $performance_id, $value );
endif;
endforeach;
diff --git a/templates/event-performance-table.php b/templates/event-performance-table.php
index 38686a67..fe08a9e3 100644
--- a/templates/event-performance-table.php
+++ b/templates/event-performance-table.php
@@ -11,8 +11,12 @@ if ( ! defined( 'ABSPATH' ) ) exit; // Exit if accessed directly
// Initialize totals
$totals = array();
+
+// Set null
+if ( ! isset( $position ) ) $position = null;
+if ( ! isset( $class ) ) $class = null;
?>
-
+
@@ -54,6 +58,8 @@ $totals = array();
$lineup_sub_relation[ sp_array_value( $sub, 'sub', 0 ) ] = $sub_id;
endforeach;
+ $data = apply_filters( 'sportspress_event_performance_players', $data, $lineups, $subs );
+
$i = 0;
foreach ( $data as $player_id => $row ):
@@ -131,9 +137,11 @@ $totals = array();
echo '' . $value . ' | ';
elseif ( intval( $value ) && $mode == 'icons' ):
$performance_id = sp_array_value( $performance_ids, $key, null );
+ $icons = '';
if ( $performance_id && has_post_thumbnail( $performance_id ) ):
- echo str_repeat( get_the_post_thumbnail( $performance_id, 'sportspress-fit-mini' ) . ' ', $value );
+ $icons = str_repeat( get_the_post_thumbnail( $performance_id, 'sportspress-fit-mini' ) . ' ', $value );
endif;
+ echo apply_filters( 'sportspress_event_performance_icons', $icons, $performance_id, $value );
endif;
endforeach;
@@ -147,111 +155,62 @@ $totals = array();
?>
-
+
<>
-
+ ';
+ }
+ echo '| ' . __( 'Total', 'sportspress' ) . ' | ';
+ endif;
- $row = sp_array_value( $data, -1, array() );
+ $row = sp_array_value( $data, 0, array() );
- if ( $mode == 'icons' ) echo '';
+ if ( $mode == 'icons' ) echo ' | ';
- foreach ( $labels as $key => $label ):
- if ( 'name' == $key )
- continue;
- if ( isset( $position ) && 'position' == $key )
- continue;
- if ( $key == 'position' ):
+ foreach ( $labels as $key => $label ):
+ if ( 'name' == $key )
+ continue;
+ if ( isset( $position ) && 'position' == $key )
+ continue;
+ if ( $key == 'position' ):
+ $value = ' ';
+ else:
+ if ( $primary && $key !== $primary ):
$value = ' ';
elseif ( array_key_exists( $key, $row ) && $row[ $key ] != '' ):
$value = $row[ $key ];
else:
- $value = ' ';
+ $value = apply_filters( 'sportspress_event_performance_table_total_value', sp_array_value( $totals, $key, 0 ), $data, $key );
endif;
-
- if ( $mode == 'values' ):
- echo ' | ' . $value . ' | ';
- elseif ( intval( $value ) && $mode == 'icons' ):
- $performance_id = sp_array_value( $performance_ids, $key, null );
- if ( $performance_id && has_post_thumbnail( $performance_id ) ):
- echo str_repeat( get_the_post_thumbnail( $performance_id, 'sportspress-fit-mini' ) . ' ', $value );
- endif;
- endif;
- endforeach;
-
- if ( $mode == 'icons' ) echo '';
- ?>
-
-
-
- ';
- }
- echo '| ' . __( 'Total', 'sportspress' ) . ' | ';
endif;
- $row = sp_array_value( $data, 0, array() );
-
- if ( $mode == 'icons' ) echo '';
-
- foreach ( $labels as $key => $label ):
- if ( 'name' == $key )
- continue;
- if ( isset( $position ) && 'position' == $key )
- continue;
- if ( $key == 'position' ):
- $value = ' ';
- else:
- if ( $primary && $key !== $primary ):
- $value = ' ';
- elseif ( array_key_exists( $key, $row ) && $row[ $key ] != '' ):
- $value = $row[ $key ];
- else:
- $value = sp_array_value( $totals, $key, 0 );
- if ( $show_extras ) {
- $value += sp_array_value( sp_array_value( $data, -1, array() ), $key, 0 );
- }
- endif;
+ if ( $mode == 'values' ):
+ echo ' | ' . $value . ' | ';
+ elseif ( intval( $value ) && $mode == 'icons' ):
+ $performance_id = sp_array_value( $performance_ids, $key, null );
+ $icons = '';
+ if ( $performance_id && has_post_thumbnail( $performance_id ) ):
+ $icons = str_repeat( get_the_post_thumbnail( $performance_id, 'sportspress-fit-mini' ) . ' ', $value );
endif;
+ echo apply_filters( 'sportspress_event_performance_icons', $icons, $performance_id, $value );
+ endif;
+ endforeach;
- if ( $mode == 'values' ):
- echo '' . $value . ' | ';
- elseif ( intval( $value ) && $mode == 'icons' ):
- $performance_id = sp_array_value( $performance_ids, $key, null );
- if ( $performance_id && has_post_thumbnail( $performance_id ) ):
- echo str_repeat( get_the_post_thumbnail( $performance_id, 'sportspress-fit-mini' ) . ' ', $value );
- endif;
- endif;
- endforeach;
-
- if ( $mode == 'icons' ) echo '';
- ?>
-
-
+ if ( $mode == 'icons' ) echo '';
+ ?>
+
>
-
\ No newline at end of file
+
+
+
\ No newline at end of file
diff --git a/templates/event-performance.php b/templates/event-performance.php
index c47e84e2..01693b24 100644
--- a/templates/event-performance.php
+++ b/templates/event-performance.php
@@ -11,16 +11,15 @@ if ( ! defined( 'ABSPATH' ) ) exit; // Exit if accessed directly
$show_players = get_option( 'sportspress_event_show_players', 'yes' ) === 'yes' ? true : false;
$show_staff = get_option( 'sportspress_event_show_staff', 'yes' ) === 'yes' ? true : false;
-$show_extras = get_option( 'sportspress_event_show_extras', 'no' ) === 'yes' ? true : false;
$show_total = get_option( 'sportspress_event_show_total', 'yes' ) === 'yes' ? true : false;
$show_numbers = get_option( 'sportspress_event_show_player_numbers', 'yes' ) === 'yes' ? true : false;
$split_positions = get_option( 'sportspress_event_split_players_by_position', 'no' ) === 'yes' ? true : false;
$split_teams = get_option( 'sportspress_event_split_players_by_team', 'yes' ) === 'yes' ? true : false;
$reverse_teams = get_option( 'sportspress_event_performance_reverse_teams', 'no' ) === 'yes' ? true : false;
-$primary = get_option( 'sportspress_primary_performance', null );
+$primary = sp_get_main_performance_option();
$total = get_option( 'sportspress_event_total_performance', 'all');
-if ( ! $show_players && ! $show_staff && ! $show_extras && ! $show_total ) return;
+if ( ! $show_players && ! $show_staff && ! $show_total ) return;
if ( ! isset( $id ) )
$id = get_the_ID();
@@ -72,9 +71,7 @@ if ( is_array( $teams ) ):
$players = sp_array_between( (array)get_post_meta( $id, 'sp_player', false ), 0, $index );
$has_players = sizeof( $players ) > 1;
- if ( $show_extras ) {
- $players[] = -1;
- }
+ $players = apply_filters( 'sportspress_event_performance_split_team_players', $players );
$show_team_players = $show_players && $has_players;
@@ -91,9 +88,9 @@ if ( is_array( $teams ) ):
$data = sp_array_value( array_values( $performance ), $index );
}
- if ( ! $show_team_players && ! $show_staff && ! $show_extras && ! $show_total ) continue;
+ if ( ! $show_team_players && ! $show_staff && ! $show_total ) continue;
- if ( $show_team_players || $show_extras || $show_total ) {
+ if ( $show_team_players || $show_total ) {
if ( $split_positions ) {
$positions = get_terms( 'sp_position', array(
'orderby' => 'slug',
@@ -138,9 +135,7 @@ if ( is_array( $teams ) ):
}
if ( sizeof( $subdata ) ) {
- if ( $show_extras ) {
- $subdata[-1] = sp_array_value( $data, -1 );
- }
+ $subdata = apply_filters( 'sportspress_event_performance_split_team_split_position_subdata', $subdata, $data );
sp_get_template( 'event-performance-table.php', array(
'position' => sp_get_position_caption( $position->term_id ),
@@ -148,7 +143,6 @@ if ( is_array( $teams ) ):
'sortable' => $sortable,
'show_players' => $show_team_players,
'show_numbers' => $show_numbers,
- 'show_extras' => $show_extras,
'show_total' => $show_total,
'caption' => 0 == $position_index && $team_id ? get_the_title( $team_id ) : null,
'labels' => $sublabels,
@@ -158,6 +152,7 @@ if ( is_array( $teams ) ):
'link_posts' => $link_posts,
'performance_ids' => isset( $performance_ids ) ? $performance_ids : null,
'primary' => 'primary' == $total ? $primary : null,
+ 'class' => 'sp-template-event-performance-team-' . $index . '-position-' . $position_index,
) );
}
}
@@ -167,7 +162,6 @@ if ( is_array( $teams ) ):
'sortable' => $sortable,
'show_players' => $show_team_players,
'show_numbers' => $show_numbers,
- 'show_extras' => $show_extras,
'show_total' => $show_total,
'caption' => $team_id ? get_the_title( $team_id ) : null,
'labels' => $labels,
@@ -222,7 +216,6 @@ if ( is_array( $teams ) ):
'sortable' => $sortable,
'show_players' => $show_players,
'show_numbers' => $show_numbers,
- 'show_extras' => $show_extras,
'show_total' => $show_total,
'caption' => sp_get_position_caption( $position->term_id ),
'labels' => $labels,
@@ -241,9 +234,8 @@ if ( is_array( $teams ) ):
'sortable' => $sortable,
'show_players' => $show_players,
'show_numbers' => $show_numbers,
- 'show_extras' => $show_extras,
'show_total' => $show_total,
- 'caption' => __( 'Performance', 'sportspress' ),
+ 'caption' => __( 'Box Score', 'sportspress' ),
'labels' => $labels,
'mode' => $mode,
'data' => $data,