Display team outcomes in admin column for events only
This commit is contained in:
@@ -51,21 +51,29 @@ function sp_manage_posts_custom_column( $column, $post_id ) {
|
|||||||
echo get_the_terms ( $post_id, 'sp_position' ) ? the_terms( $post_id, 'sp_position' ) : '—';
|
echo get_the_terms ( $post_id, 'sp_position' ) ? the_terms( $post_id, 'sp_position' ) : '—';
|
||||||
break;
|
break;
|
||||||
case 'sp_team':
|
case 'sp_team':
|
||||||
$results = get_post_meta( $post_id, 'sp_results', true );
|
$post_type = get_post_type( $post );
|
||||||
$teams = get_post_meta ( $post_id, 'sp_team', false );
|
$teams = get_post_meta ( $post_id, 'sp_team', false );
|
||||||
foreach( $teams as $team_id ):
|
if ( $post_type == 'sp_event' ):
|
||||||
$team = get_post( $team_id );
|
$results = get_post_meta( $post_id, 'sp_results', true );
|
||||||
$outcome_slug = sp_array_value( sp_array_value( $results, $team_id, null ), 'outcome', null );
|
foreach( $teams as $team_id ):
|
||||||
|
$team = get_post( $team_id );
|
||||||
|
$outcome_slug = sp_array_value( sp_array_value( $results, $team_id, null ), 'outcome', null );
|
||||||
|
|
||||||
$args=array(
|
$args=array(
|
||||||
'name' => $outcome_slug,
|
'name' => $outcome_slug,
|
||||||
'post_type' => 'sp_outcome',
|
'post_type' => 'sp_outcome',
|
||||||
'post_status' => 'publish',
|
'post_status' => 'publish',
|
||||||
'posts_per_page' => 1
|
'posts_per_page' => 1
|
||||||
);
|
);
|
||||||
$outcomes = get_posts( $args );
|
$outcomes = get_posts( $args );
|
||||||
echo $team->post_title . ( $outcomes ? ' — ' . $outcomes[0]->post_title : '' ) . '<br>';
|
echo $team->post_title . ( $outcomes ? ' — ' . $outcomes[0]->post_title : '' ) . '<br>';
|
||||||
endforeach;
|
endforeach;
|
||||||
|
else:
|
||||||
|
foreach( $teams as $team_id ):
|
||||||
|
$team = get_post( $team_id );
|
||||||
|
echo $team->post_title . '<br>';
|
||||||
|
endforeach;
|
||||||
|
endif;
|
||||||
break;
|
break;
|
||||||
case 'sp_equation':
|
case 'sp_equation':
|
||||||
echo sp_get_post_equation( $post_id );
|
echo sp_get_post_equation( $post_id );
|
||||||
|
|||||||
Reference in New Issue
Block a user