Apply team reversal in admin
This commit is contained in:
@@ -39,6 +39,10 @@ class SP_Event extends SP_Custom_Post{
|
|||||||
// Get results for all teams
|
// Get results for all teams
|
||||||
$data = sp_array_combine( $teams, $results, true );
|
$data = sp_array_combine( $teams, $results, true );
|
||||||
|
|
||||||
|
if ( 'yes' === get_option( 'sportspress_event_results_reverse_teams', 'no' ) ) {
|
||||||
|
$data = array_reverse( $data, true );
|
||||||
|
}
|
||||||
|
|
||||||
if ( $admin ):
|
if ( $admin ):
|
||||||
return array( $columns, $usecolumns, $data );
|
return array( $columns, $usecolumns, $data );
|
||||||
else:
|
else:
|
||||||
@@ -117,7 +121,7 @@ class SP_Event extends SP_Custom_Post{
|
|||||||
endif;
|
endif;
|
||||||
endforeach;
|
endforeach;
|
||||||
if ( ! array_key_exists( 'number', $player_performance ) ):
|
if ( ! array_key_exists( 'number', $player_performance ) ):
|
||||||
$performance[ $team_id ][ $player_id ]['number'] = get_post_meta( $player_id, 'sp_number', true );
|
$performance[ $team_id ][ $player_id ]['number'] = apply_filters( 'sportspress_event_performance_default_squad_number', get_post_meta( $player_id, 'sp_number', true ) );
|
||||||
endif;
|
endif;
|
||||||
if ( ! array_key_exists( 'position', $player_performance ) || $player_performance['position'] == null ):
|
if ( ! array_key_exists( 'position', $player_performance ) || $player_performance['position'] == null ):
|
||||||
$performance[ $team_id ][ $player_id ]['position'] = sp_get_the_term_id( $player_id, 'sp_position', null );
|
$performance[ $team_id ][ $player_id ]['position'] = sp_get_the_term_id( $player_id, 'sp_position', null );
|
||||||
|
|||||||
@@ -10,8 +10,6 @@
|
|||||||
if ( ! defined( 'ABSPATH' ) ) exit; // Exit if accessed directly
|
if ( ! defined( 'ABSPATH' ) ) exit; // Exit if accessed directly
|
||||||
if ( get_option( 'sportspress_event_show_results', 'yes' ) === 'no' ) return;
|
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 ) )
|
if ( ! isset( $id ) )
|
||||||
$id = get_the_ID();
|
$id = get_the_ID();
|
||||||
|
|
||||||
@@ -43,10 +41,6 @@ $output = '';
|
|||||||
$table_rows = '';
|
$table_rows = '';
|
||||||
$i = 0;
|
$i = 0;
|
||||||
|
|
||||||
if ( $reverse_teams ) {
|
|
||||||
$data = array_reverse( $data, true );
|
|
||||||
}
|
|
||||||
|
|
||||||
foreach( $data as $team_id => $result ):
|
foreach( $data as $team_id => $result ):
|
||||||
if ( $show_outcomes ):
|
if ( $show_outcomes ):
|
||||||
$outcomes = array();
|
$outcomes = array();
|
||||||
@@ -81,7 +75,7 @@ foreach( $data as $team_id => $result ):
|
|||||||
if ( array_key_exists( $key, $result ) && $result[ $key ] != '' ):
|
if ( array_key_exists( $key, $result ) && $result[ $key ] != '' ):
|
||||||
$value = $result[ $key ];
|
$value = $result[ $key ];
|
||||||
else:
|
else:
|
||||||
$value = '—';
|
$value = apply_filters( 'sportspress_event_empty_result_string', '—' );
|
||||||
endif;
|
endif;
|
||||||
$table_rows .= '<td class="data-' . $key . '">' . $value . '</td>';
|
$table_rows .= '<td class="data-' . $key . '">' . $value . '</td>';
|
||||||
endforeach;
|
endforeach;
|
||||||
|
|||||||
Reference in New Issue
Block a user