Display team names only when available
This commit is contained in:
@@ -49,6 +49,7 @@ function sportspress_manage_posts_custom_column( $column, $post_id ) {
|
|||||||
if ( ! $team_id ) continue;
|
if ( ! $team_id ) continue;
|
||||||
$team = get_post( $team_id );
|
$team = get_post( $team_id );
|
||||||
|
|
||||||
|
if ( $team ):
|
||||||
$team_results = sportspress_array_value( $results, $team_id, null );
|
$team_results = sportspress_array_value( $results, $team_id, null );
|
||||||
|
|
||||||
if ( $main_result ):
|
if ( $main_result ):
|
||||||
@@ -69,23 +70,26 @@ function sportspress_manage_posts_custom_column( $column, $post_id ) {
|
|||||||
echo $team->post_title;
|
echo $team->post_title;
|
||||||
|
|
||||||
echo '<br>';
|
echo '<br>';
|
||||||
|
endif;
|
||||||
endforeach;
|
endforeach;
|
||||||
elseif ( $post_type == 'sp_player' ):
|
elseif ( $post_type == 'sp_player' ):
|
||||||
$current_team = get_post_meta( $post_id, 'sp_current_team', true );
|
$current_team = get_post_meta( $post_id, 'sp_current_team', true );
|
||||||
foreach( $teams as $team_id ):
|
foreach( $teams as $team_id ):
|
||||||
if ( ! $team_id ) continue;
|
if ( ! $team_id ) continue;
|
||||||
$team = get_post( $team_id );
|
$team = get_post( $team_id );
|
||||||
|
if ( $team ):
|
||||||
echo $team->post_title;
|
echo $team->post_title;
|
||||||
if ( $team_id == $current_team ):
|
if ( $team_id == $current_team ):
|
||||||
echo '<span class="dashicons dashicons-yes" title="' . __( 'Current Team', 'sportspress' ) . '"></span>';
|
echo '<span class="dashicons dashicons-yes" title="' . __( 'Current Team', 'sportspress' ) . '"></span>';
|
||||||
endif;
|
endif;
|
||||||
echo '<br>';
|
echo '<br>';
|
||||||
|
endif;
|
||||||
endforeach;
|
endforeach;
|
||||||
else:
|
else:
|
||||||
foreach( $teams as $team_id ):
|
foreach( $teams as $team_id ):
|
||||||
if ( ! $team_id ) continue;
|
if ( ! $team_id ) continue;
|
||||||
$team = get_post( $team_id );
|
$team = get_post( $team_id );
|
||||||
echo $team->post_title . '<br>';
|
if ( $team ) echo $team->post_title . '<br>';
|
||||||
endforeach;
|
endforeach;
|
||||||
endif;
|
endif;
|
||||||
break;
|
break;
|
||||||
|
|||||||
Reference in New Issue
Block a user