get_option( 'sportspress_event_show_outcomes', 'yes' ) == 'yes' ? true : false, ); extract( $defaults, EXTR_SKIP ); $teams = (array)get_post_meta( $id, 'sp_team', false ); $results = array_filter( sp_array_combine( $teams, (array)get_post_meta( $id, 'sp_results', true ) ), 'array_filter' ); $result_labels = sp_get_var_labels( 'sp_result' ); $output = ''; // Initialize and check $table_rows = ''; $i = 0; if ( empty( $results ) ) return false; foreach( $results as $team_id => $result ): if ( count( array_filter( $results ) ) ): if ( $show_outcomes ): $outcomes = array(); $result_outcome = $result['outcome']; if ( ! is_array( $result_outcome ) ): $result_outcome = (array) $result_outcome; endif; foreach( $result_outcome as $outcome ): $the_outcome = get_page_by_path( $outcome, OBJECT, 'sp_outcome' ); if ( is_object( $the_outcome ) ): $outcomes[] = $the_outcome->post_title; endif; endforeach; endif; unset( $result['outcome'] ); $table_rows .= '
| ' . SP()->text->string('Team') . ' | '; foreach( $result_labels as $key => $label ): $output .= '' . $label . ' | '; endforeach; if ( $show_outcomes ): $output .= '' . SP()->text->string('Outcome') . ' | '; endif; $output .= '' . '' . ''; $output .= $table_rows; $output .= '' . '
|---|