Display team names only when available
This commit is contained in:
@@ -49,43 +49,47 @@ 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 );
|
||||||
|
|
||||||
$team_results = sportspress_array_value( $results, $team_id, null );
|
if ( $team ):
|
||||||
|
$team_results = sportspress_array_value( $results, $team_id, null );
|
||||||
|
|
||||||
if ( $main_result ):
|
if ( $main_result ):
|
||||||
$team_result = sportspress_array_value( $team_results, $main_result, null );
|
$team_result = sportspress_array_value( $team_results, $main_result, null );
|
||||||
else:
|
|
||||||
if ( is_array( $team_results ) ):
|
|
||||||
end( $team_results );
|
|
||||||
$team_result = prev( $team_results );
|
|
||||||
else:
|
else:
|
||||||
$team_result = null;
|
if ( is_array( $team_results ) ):
|
||||||
|
end( $team_results );
|
||||||
|
$team_result = prev( $team_results );
|
||||||
|
else:
|
||||||
|
$team_result = null;
|
||||||
|
endif;
|
||||||
endif;
|
endif;
|
||||||
|
|
||||||
|
if ( $team_result != null ):
|
||||||
|
echo '<strong>' . $team_result . '</strong> ';
|
||||||
|
endif;
|
||||||
|
|
||||||
|
echo $team->post_title;
|
||||||
|
|
||||||
|
echo '<br>';
|
||||||
endif;
|
endif;
|
||||||
|
|
||||||
if ( $team_result != null ):
|
|
||||||
echo '<strong>' . $team_result . '</strong> ';
|
|
||||||
endif;
|
|
||||||
|
|
||||||
echo $team->post_title;
|
|
||||||
|
|
||||||
echo '<br>';
|
|
||||||
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 );
|
||||||
echo $team->post_title;
|
if ( $team ):
|
||||||
if ( $team_id == $current_team ):
|
echo $team->post_title;
|
||||||
echo '<span class="dashicons dashicons-yes" title="' . __( 'Current Team', 'sportspress' ) . '"></span>';
|
if ( $team_id == $current_team ):
|
||||||
|
echo '<span class="dashicons dashicons-yes" title="' . __( 'Current Team', 'sportspress' ) . '"></span>';
|
||||||
|
endif;
|
||||||
|
echo '<br>';
|
||||||
endif;
|
endif;
|
||||||
echo '<br>';
|
|
||||||
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