Add ability to reverse home/away team order in events
This commit is contained in:
@@ -179,6 +179,14 @@ class SP_Settings_Events extends SP_Settings_Page {
|
||||
'manual' => __( 'Manual', 'sportspress' ),
|
||||
),
|
||||
),
|
||||
|
||||
array(
|
||||
'title' => __( 'Teams', 'sportspress' ),
|
||||
'desc' => __( 'Reverse order', 'sportspress' ),
|
||||
'id' => 'sportspress_event_results_reverse_teams',
|
||||
'default' => 'no',
|
||||
'type' => 'checkbox',
|
||||
),
|
||||
|
||||
array(
|
||||
'title' => __( 'Outcome', 'sportspress' ),
|
||||
@@ -241,14 +249,6 @@ class SP_Settings_Events extends SP_Settings_Page {
|
||||
'manual' => __( 'Manual', 'sportspress' ),
|
||||
),
|
||||
),
|
||||
|
||||
array(
|
||||
'title' => __( 'Position', 'sportspress' ),
|
||||
'desc' => __( 'Display position', 'sportspress' ),
|
||||
'id' => 'sportspress_event_show_position',
|
||||
'default' => 'yes',
|
||||
'type' => 'checkbox',
|
||||
),
|
||||
|
||||
array(
|
||||
'title' => __( 'Mode', 'sportspress' ),
|
||||
@@ -261,6 +261,14 @@ class SP_Settings_Events extends SP_Settings_Page {
|
||||
),
|
||||
),
|
||||
|
||||
array(
|
||||
'title' => __( 'Teams', 'sportspress' ),
|
||||
'desc' => __( 'Reverse order', 'sportspress' ),
|
||||
'id' => 'sportspress_event_performance_reverse_teams',
|
||||
'default' => 'no',
|
||||
'type' => 'checkbox',
|
||||
),
|
||||
|
||||
array(
|
||||
'title' => __( 'Players', 'sportspress' ),
|
||||
'desc' => __( 'Display squad numbers', 'sportspress' ),
|
||||
@@ -269,6 +277,14 @@ class SP_Settings_Events extends SP_Settings_Page {
|
||||
'type' => 'checkbox',
|
||||
'checkboxgroup' => 'start',
|
||||
),
|
||||
|
||||
array(
|
||||
'desc' => __( 'Display positions', 'sportspress' ),
|
||||
'id' => 'sportspress_event_show_position',
|
||||
'default' => 'yes',
|
||||
'type' => 'checkbox',
|
||||
'checkboxgroup' => '',
|
||||
),
|
||||
|
||||
array(
|
||||
'desc' => __( 'Split players by team', 'sportspress' ),
|
||||
|
||||
@@ -16,6 +16,7 @@ $show_total = get_option( 'sportspress_event_show_total', 'yes' ) === 'yes' ? tr
|
||||
$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 );
|
||||
$total = get_option( 'sportspress_event_total_performance', 'all');
|
||||
|
||||
@@ -55,6 +56,10 @@ if ( is_array( $teams ) ):
|
||||
endforeach;
|
||||
endif;
|
||||
|
||||
if ( $reverse_teams ) {
|
||||
$teams = array_reverse( $teams, true );
|
||||
}
|
||||
|
||||
if ( $split_teams ) {
|
||||
// Split tables
|
||||
foreach( $teams as $index => $team_id ):
|
||||
|
||||
@@ -10,6 +10,8 @@
|
||||
if ( ! defined( 'ABSPATH' ) ) exit; // Exit if accessed directly
|
||||
if ( get_option( 'sportspress_event_show_results', 'yes' ) === 'no' ) return;
|
||||
|
||||
$reverse_teams = get_option( 'sportspress_event_results_reverse_teams', 'no' ) === 'yes' ? true : false;
|
||||
|
||||
if ( ! isset( $id ) )
|
||||
$id = get_the_ID();
|
||||
|
||||
@@ -41,6 +43,10 @@ $output = '';
|
||||
$table_rows = '';
|
||||
$i = 0;
|
||||
|
||||
if ( $reverse_teams ) {
|
||||
$data = array_reverse( $data, true );
|
||||
}
|
||||
|
||||
foreach( $data as $team_id => $result ):
|
||||
if ( $show_outcomes ):
|
||||
$outcomes = array();
|
||||
|
||||
Reference in New Issue
Block a user