Handle deleted players and teams in templates
This commit is contained in:
@@ -42,6 +42,11 @@ if ( !function_exists( 'sportspress_event_players' ) ) {
|
|||||||
if ( ! $player_id )
|
if ( ! $player_id )
|
||||||
continue;
|
continue;
|
||||||
|
|
||||||
|
$name = get_the_title( $player_id );
|
||||||
|
|
||||||
|
if ( ! $name )
|
||||||
|
continue;
|
||||||
|
|
||||||
$output .= '<tr class="' . ( $i % 2 == 0 ? 'odd' : 'even' ) . '">';
|
$output .= '<tr class="' . ( $i % 2 == 0 ? 'odd' : 'even' ) . '">';
|
||||||
|
|
||||||
$number = get_post_meta( $player_id, 'sp_number', true );
|
$number = get_post_meta( $player_id, 'sp_number', true );
|
||||||
@@ -51,7 +56,6 @@ if ( !function_exists( 'sportspress_event_players' ) ) {
|
|||||||
|
|
||||||
// Name as link
|
// Name as link
|
||||||
$permalink = get_post_permalink( $player_id );
|
$permalink = get_post_permalink( $player_id );
|
||||||
$name = get_the_title( $player_id );
|
|
||||||
$output .= '<td class="data-name">' . '<a href="' . $permalink . '">' . $name . '</a></td>';
|
$output .= '<td class="data-name">' . '<a href="' . $permalink . '">' . $name . '</a></td>';
|
||||||
|
|
||||||
foreach( $statistic_labels as $key => $label ):
|
foreach( $statistic_labels as $key => $label ):
|
||||||
|
|||||||
@@ -41,17 +41,20 @@ if ( !function_exists( 'sportspress_league_table' ) ) {
|
|||||||
$i = 0;
|
$i = 0;
|
||||||
|
|
||||||
if ( is_int( $r['number'] ) && $r['number'] > 0 )
|
if ( is_int( $r['number'] ) && $r['number'] > 0 )
|
||||||
$data = array_slice( $data, 0, $r['number'] );
|
$limit = $r['number'];
|
||||||
|
|
||||||
foreach( $data as $team_id => $row ):
|
foreach( $data as $team_id => $row ):
|
||||||
|
|
||||||
|
if ( $i >= $r['number'] ) continue;
|
||||||
|
|
||||||
|
$name = sportspress_array_value( $row, 'name', null );
|
||||||
|
if ( ! $name ) continue;
|
||||||
|
|
||||||
$output .= '<tr class="' . ( $i % 2 == 0 ? 'odd' : 'even' ) . '">';
|
$output .= '<tr class="' . ( $i % 2 == 0 ? 'odd' : 'even' ) . '">';
|
||||||
|
|
||||||
// Rank
|
// Rank
|
||||||
$output .= '<td class="data-rank">' . ( $i + 1 ) . '</td>';
|
$output .= '<td class="data-rank">' . ( $i + 1 ) . '</td>';
|
||||||
|
|
||||||
$name = sportspress_array_value( $row, 'name', sportspress_array_value( $row, 'name', ' ' ) );
|
|
||||||
|
|
||||||
if ( $r['show_team_logo'] )
|
if ( $r['show_team_logo'] )
|
||||||
$name = get_the_post_thumbnail( $team_id, 'sportspress-fit-icon' ) . ' ' . $name;
|
$name = get_the_post_thumbnail( $team_id, 'sportspress-fit-icon' ) . ' ' . $name;
|
||||||
|
|
||||||
|
|||||||
@@ -57,6 +57,9 @@ if ( !function_exists( 'sportspress_player_list' ) ) {
|
|||||||
|
|
||||||
foreach( $data as $player_id => $row ):
|
foreach( $data as $player_id => $row ):
|
||||||
|
|
||||||
|
$name = sportspress_array_value( $row, 'name', null );
|
||||||
|
if ( ! $name ) continue;
|
||||||
|
|
||||||
$output .= '<tr class="' . ( $i % 2 == 0 ? 'odd' : 'even' ) . '">';
|
$output .= '<tr class="' . ( $i % 2 == 0 ? 'odd' : 'even' ) . '">';
|
||||||
|
|
||||||
// Rank or number
|
// Rank or number
|
||||||
@@ -69,7 +72,6 @@ if ( !function_exists( 'sportspress_player_list' ) ) {
|
|||||||
|
|
||||||
// Name as link
|
// Name as link
|
||||||
$permalink = get_post_permalink( $player_id );
|
$permalink = get_post_permalink( $player_id );
|
||||||
$name = sportspress_array_value( $row, 'name', sportspress_array_value( $row, 'name', ' ' ) );
|
|
||||||
$output .= '<td class="data-name">' . '<a href="' . $permalink . '">' . $name . '</a></td>';
|
$output .= '<td class="data-name">' . '<a href="' . $permalink . '">' . $name . '</a></td>';
|
||||||
|
|
||||||
foreach( $labels as $key => $value ):
|
foreach( $labels as $key => $value ):
|
||||||
|
|||||||
Reference in New Issue
Block a user