Display team outcomes in admin column for events only
This commit is contained in:
@@ -51,8 +51,10 @@ 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 );
|
||||||
|
if ( $post_type == 'sp_event' ):
|
||||||
|
$results = get_post_meta( $post_id, 'sp_results', true );
|
||||||
foreach( $teams as $team_id ):
|
foreach( $teams as $team_id ):
|
||||||
$team = get_post( $team_id );
|
$team = get_post( $team_id );
|
||||||
$outcome_slug = sp_array_value( sp_array_value( $results, $team_id, null ), 'outcome', null );
|
$outcome_slug = sp_array_value( sp_array_value( $results, $team_id, null ), 'outcome', null );
|
||||||
@@ -66,6 +68,12 @@ function sp_manage_posts_custom_column( $column, $post_id ) {
|
|||||||
$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