Display team names only when available

This commit is contained in:
Brian Miyaji
2014-03-16 11:38:50 +11:00
parent 94d50adcc2
commit 4a225ef034

View File

@@ -49,6 +49,7 @@ function sportspress_manage_posts_custom_column( $column, $post_id ) {
if ( ! $team_id ) continue;
$team = get_post( $team_id );
if ( $team ):
$team_results = sportspress_array_value( $results, $team_id, null );
if ( $main_result ):
@@ -69,23 +70,26 @@ function sportspress_manage_posts_custom_column( $column, $post_id ) {
echo $team->post_title;
echo '<br>';
endif;
endforeach;
elseif ( $post_type == 'sp_player' ):
$current_team = get_post_meta( $post_id, 'sp_current_team', true );
foreach( $teams as $team_id ):
if ( ! $team_id ) continue;
$team = get_post( $team_id );
if ( $team ):
echo $team->post_title;
if ( $team_id == $current_team ):
echo '<span class="dashicons dashicons-yes" title="' . __( 'Current Team', 'sportspress' ) . '"></span>';
endif;
echo '<br>';
endif;
endforeach;
else:
foreach( $teams as $team_id ):
if ( ! $team_id ) continue;
$team = get_post( $team_id );
echo $team->post_title . '<br>';
if ( $team ) echo $team->post_title . '<br>';
endforeach;
endif;
break;