__( 'Pos', 'sportspress' ), 'thumbnails' => 0, 'thumbnail_size' => 'thumbnail' ); $r = wp_parse_args( $args, $defaults ); $leagues = get_the_terms( $id, 'sp_league' ); $seasons = get_the_terms( $id, 'sp_season' ); $terms = array(); if ( isset( $leagues[0] ) ) $terms[] = $leagues[0]->name; if ( isset( $seasons[0] ) ) $terms[] = $seasons[0]->name; $title = sizeof( $terms ) ? implode( ' — ', $terms ) : get_the_title( $id ); $output = '

' . $title . '

' . '
' . '' . '' . ''; $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] ); $output .= ''; foreach( $labels as $key => $label ): $output .= ''; endforeach; $output .= '' . '' . ''; $i = 0; foreach( $data as $team_id => $row ): $output .= ''; // Position as number $output .= ''; // Thumbnail and name as link $permalink = get_post_permalink( $team_id ); if ( $r['thumbnails'] ): $thumbnail = get_the_post_thumbnail( $team_id, $r['thumbnail_size'], array( 'class' => 'logo' ) ); else: $thumbnail = null; endif; $name = sportspress_array_value( $row, 'name', sportspress_array_value( $row, 'name', ' ' ) ); $output .= ''; foreach( $labels as $key => $value ): if ( $key == 'name' ) continue; $output .= ''; endforeach; $output .= ''; $i++; endforeach; $output .= '' . '
' . $r['number_label'] . '' . $label . '
' . $i . '' . ( $thumbnail ? $thumbnail . ' ' : '' ) . '' . $name . '' . sportspress_array_value( $row, $key, '—' ) . '
' . '
'; return apply_filters( 'sportspress_league_table', $output ); } }