null, ); $r = wp_parse_args( $args, $defaults ); $output = '
' . '' . '' . ''; $data = sportspress_get_league_table_data( $id ); // The first row should be column labels $labels = $data[0]; // Remove the first row to leave us with the actual data unset( $data[0] ); $columns = sportspress_array_value( $r, 'columns', null ); $output .= ''; foreach( $labels as $key => $label ): if ( ! is_array( $columns ) || $key == 'name' || in_array( $key, $columns ) ) $output .= ''; endforeach; $output .= '' . '' . ''; $i = 0; foreach( $data as $team_id => $row ): $output .= ''; // Rank $output .= ''; $name = sportspress_array_value( $row, 'name', sportspress_array_value( $row, 'name', ' ' ) ); $output .= ''; foreach( $labels as $key => $value ): if ( $key == 'name' ) continue; if ( ! is_array( $columns ) || in_array( $key, $columns ) ) $output .= ''; endforeach; $output .= ''; $i++; endforeach; $output .= '' . '
' . __( 'Pos', 'sportspress' ) . '' . $label . '
' . ( $i + 1 ) . '' . $name . '' . sportspress_array_value( $row, $key, '—' ) . '
' . '
'; return apply_filters( 'sportspress_league_table', $output, $id ); } }