status(); if ( 'results' != $status ) return; // Get event result data $data = $event->results(); // The first row should be column labels $labels = $data[0]; // Remove the first row to leave us with the actual data unset( $data[0] ); $data = array_filter( $data ); if ( empty( $data ) ) return false; $scrollable = get_option( 'sportspress_enable_scrollable_tables', 'yes' ) == 'yes' ? true : false; $link_teams = get_option( 'sportspress_link_teams', 'no' ) == 'yes' ? true : false; $show_outcomes = array_key_exists( 'outcome', $labels ); // Initialize $output = ''; $table_rows = ''; $i = 0; if ( $reverse_teams ) { $data = array_reverse( $data, true ); } foreach( $data as $team_id => $result ): if ( $show_outcomes ): $outcomes = array(); $result_outcome = sp_array_value( $result, 'outcome' ); if ( ! is_array( $result_outcome ) ): $outcomes = array( '—' ); else: foreach( $result_outcome as $outcome ): $the_outcome = get_page_by_path( $outcome, OBJECT, 'sp_outcome' ); if ( is_object( $the_outcome ) ): $outcomes[] = $the_outcome->post_title; endif; endforeach; endif; endif; unset( $result['outcome'] ); $table_rows .= '
| ' . __( 'Team', 'sportspress' ) . ' | '; foreach( $labels as $key => $label ): $output .= '' . $label . ' | '; endforeach; $output .= '' . '' . ''; $output .= $table_rows; $output .= '' . '
|---|