Apply "Reverse Teams" to home and away records

This commit is contained in:
Nabil Kadimi
2018-06-28 22:32:55 +01:00
committed by GitHub
parent 64123e7b60
commit a5cd20c870

View File

@@ -550,6 +550,12 @@ class SP_League_Table extends SP_Secondary_Post {
$totals[ $team_id ]['last10'] = $last10;
endforeach;
// Reverse home and away records when "Reverse Teams" is enabled.
$reverse_teams = get_option( 'sportspress_event_reverse_teams', 'no' ) === 'yes' ? true : false;
if ( $reverse_teams ) {
list( $homerecords, $awayrecords ) = array( $awayrecords, $homerecords );
}
foreach ( $homerecords as $team_id => $homerecord ):
// Add home record to totals
$totals[ $team_id ]['homerecord'] = $homerecord;