' . '' . ''; // The first row should be column labels $labels = $data[0]; // Remove the first row to leave us with the actual data unset( $data[0] ); $output .= '' . __( '#', 'sportspress' ) . ''; foreach( $labels as $key => $label ): $output .= '' . $label . ''; endforeach; $output .= '' . '' . ''; $i = 1; foreach( $data as $team_id => $row ): $output .= ''; // Position as number $output .= '' . $i . ''; // Thumbnail and name as link $permalink = get_post_permalink( $team_id ); $thumbnail = get_the_post_thumbnail( $team_id, 'thumbnail', array( 'class' => 'logo' ) ); $name = sportspress_array_value( $row, 'name', sportspress_array_value( $row, 'name', ' ' ) ); $output .= '' . ( $thumbnail ? $thumbnail . ' ' : '' ) . '' . $name . ''; foreach( $labels as $key => $value ): if ( $key == 'name' ) continue; $output .= '' . sportspress_array_value( $row, $key, '—' ) . ''; endforeach; $output .= ''; $i++; endforeach; $output .= '' . ''; return $output; } } if ( !function_exists( 'sportspress_player_list' ) ) { function sportspress_player_list( $id ) { $data = sportspress_get_player_list_data( $id ); $output = '' . '' . ''; // The first row should be column labels $labels = $data[0]; // Remove the first row to leave us with the actual data unset( $data[0] ); $output .= ''; foreach( $labels as $key => $label ): $output .= ''; endforeach; $output .= '' . '' . ''; $i = 1; foreach( $data as $player_id => $row ): $output .= ''; // Player number $number = get_post_meta( $player_id, 'sp_number', true ); $output .= ''; // Name as link $permalink = get_post_permalink( $player_id ); $name = sportspress_array_value( $row, 'name', sportspress_array_value( $row, 'name', ' ' ) ); $output .= ''; foreach( $labels as $key => $value ): if ( $key == 'name' ) continue; $output .= ''; endforeach; $output .= ''; endforeach; $output .= '' . '
' . __( '#', 'sportspress' ) . '' . $label . '
' . ( $number ? $number : ' ' ) . '' . '' . $name . '' . sportspress_array_value( $row, $key, '—' ) . '
'; return $output; } } if ( !function_exists( 'sportspress_player_statistics' ) ) { function sportspress_player_statistics( $id ) { $team_ids = (array)get_post_meta( $id, 'sp_team', false ); // First one is empty unset( $team_ids[0] ); // Loop through statistics for each team foreach ( $team_ids as $team_id ): $data = sportspress_get_player_statistics_data( $id, $team_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] ); $output = '' . '' . ''; foreach( $labels as $key => $label ): $output .= ''; endforeach; $output .= '' . '' . ''; $i = 1; foreach( $data as $season_id => $row ): $output .= ''; foreach( $labels as $key => $value ): $output .= ''; endforeach; $output .= ''; endforeach; $output .= '' . '
' . $label . '
' . sportspress_array_value( $row, $key, '—' ) . '
'; endforeach; return $output; } }