get_the_ID(), 'number' => -1, 'columns' => null, 'show_full_table_link' => false, 'show_team_logo' => get_option( 'sportspress_table_show_logos', 'yes' ) == 'yes' ? true : false, 'show_caption' => false, 'link_posts' => get_option( 'sportspress_table_link_teams', 'no' ) == 'yes' ? true : false, 'sortable' => get_option( 'sportspress_enable_sortable_tables', 'yes' ) == 'yes' ? true : false, 'responsive' => get_option( 'sportspress_enable_responsive_tables', 'yes' ) == 'yes' ? true : false, 'paginated' => get_option( 'sportspress_table_paginated', 'yes' ) == 'yes' ? true : false, 'rows' => get_option( 'sportspress_table_rows', 10 ), ); extract( $defaults, EXTR_SKIP ); $output = '
' . ''; if ( $show_caption ): $output .= ''; endif; $output .= '' . ''; $table = new SP_League_Table( $id ); $data = $table->data(); // The first row should be column labels $labels = $data[0]; // Remove the first row to leave us with the actual data unset( $data[0] ); if ( ! $columns ) $columns = get_post_meta( $id, 'sp_columns', true ); if ( ! is_array( $columns ) ) $columns = explode( ',', $columns ); $output .= ''; foreach( $labels as $key => $label ): if ( ! is_array( $columns ) || $key == 'name' || in_array( $key, $columns ) ) $output .= ''; endforeach; $output .= '' . '' . ''; $i = 0; if ( is_int( $number ) && $number > 0 ) $limit = $number; foreach( $data as $team_id => $row ): if ( isset( $limit ) && $i >= $limit ) continue; $name = sp_array_value( $row, 'name', null ); if ( ! $name ) continue; $output .= ''; // Rank $output .= ''; if ( $show_team_logo ): $logo = get_the_post_thumbnail( $team_id, 'sportspress-fit-icon', array( 'class' => 'team-logo' ) ); $name = str_replace( 'wp-post-image', '', $logo ) . ' ' . $name; endif; if ( $link_posts ): $permalink = get_post_permalink( $team_id ); $name = '' . $name . ''; endif; $output .= ''; foreach( $labels as $key => $value ): if ( $key == 'name' ) continue; if ( ! is_array( $columns ) || in_array( $key, $columns ) ) $output .= ''; endforeach; $output .= ''; $i++; endforeach; $output .= '' . '
' . get_the_title( $id ) . '
' . SP()->text->string('Pos') . '' . $label . '
' . ( $i + 1 ) . '' . $name . '' . sp_array_value( $row, $key, '—' ) . '
'; if ( $show_full_table_link ) $output .= '' . SP()->text->string('View full table') . ''; $output .= '
'; echo $output;