Better way of getting ID
This commit is contained in:
@@ -2,10 +2,11 @@
|
||||
if ( !function_exists( 'sportspress_player_league_statistics' ) ) {
|
||||
function sportspress_player_league_statistics( $league, $id = null ) {
|
||||
|
||||
if ( ! $id ):
|
||||
global $post;
|
||||
$id = $post->ID;
|
||||
endif;
|
||||
if ( ! $league )
|
||||
return false;
|
||||
|
||||
if ( ! $id )
|
||||
$id = get_the_ID();
|
||||
|
||||
$data = sportspress_get_player_statistics_data( $id, $league->term_id );
|
||||
|
||||
@@ -15,8 +16,12 @@ if ( !function_exists( 'sportspress_player_league_statistics' ) ) {
|
||||
// Remove the first row to leave us with the actual data
|
||||
unset( $data[0] );
|
||||
|
||||
$output = '<table class="sp-player-statistics sp-data-table">' .
|
||||
'<caption>' . $league->name . '</caption>' . '<thead>' . '<tr>';
|
||||
// Skip if there are no rows in the table
|
||||
if ( empty( $data ) )
|
||||
return false;
|
||||
|
||||
$output = '<h4 class="sp-table-caption">' . $league->name . '</h4>' .
|
||||
'<table class="sp-player-statistics sp-data-table">' . '<thead>' . '<tr>';
|
||||
|
||||
foreach( $labels as $key => $label ):
|
||||
$output .= '<th class="data-' . $key . '">' . $label . '</th>';
|
||||
|
||||
Reference in New Issue
Block a user