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