From 6c603768d595482dfca76ba0b5dc5323f5a3b315 Mon Sep 17 00:00:00 2001 From: Brian Miyaji Date: Tue, 29 Apr 2014 16:48:34 +1000 Subject: [PATCH] Add Time/Results column to event list --- .../class-sp-meta-box-calendar-data.php | 14 ++++++++++++-- includes/sp-core-functions.php | 1 + templates/event-list.php | 15 ++++++++++++--- 3 files changed, 25 insertions(+), 5 deletions(-) diff --git a/includes/admin/post-types/meta-boxes/class-sp-meta-box-calendar-data.php b/includes/admin/post-types/meta-boxes/class-sp-meta-box-calendar-data.php index 0f807470..4d749593 100644 --- a/includes/admin/post-types/meta-boxes/class-sp-meta-box-calendar-data.php +++ b/includes/admin/post-types/meta-boxes/class-sp-meta-box-calendar-data.php @@ -61,7 +61,7 @@ class SP_Meta_Box_Calendar_Data { @@ -86,6 +86,7 @@ class SP_Meta_Box_Calendar_Data { foreach ( $data as $event ): $teams = get_post_meta( $event->ID, 'sp_team' ); $results = get_post_meta( $event->ID, 'sp_results', true ); + $main_results = array(); $video = get_post_meta( $event->ID, 'sp_video', true ); ?> @@ -110,6 +111,7 @@ class SP_Meta_Box_Calendar_Data { endif; if ( $team_result != null ): + $main_results[] = $team_result; unset( $team_results['outcome'] ); $team_results = implode( ' | ', $team_results ); echo '' . $team_result . ' '; @@ -120,7 +122,15 @@ class SP_Meta_Box_Calendar_Data { endforeach; ?> - + + + ID, 'sp_venue' ); ?> diff --git a/includes/sp-core-functions.php b/includes/sp-core-functions.php index 301a5a90..08cec2c0 100644 --- a/includes/sp-core-functions.php +++ b/includes/sp-core-functions.php @@ -3231,6 +3231,7 @@ function sp_get_text_options() { 'team' => __( 'Team', 'sportspress' ), 'teams' => __( 'Teams', 'sportspress' ), 'time' => __( 'Time', 'sportspress' ), + 'timeresults' => __( 'Time/Results', 'sportspress' ), 'total' => __( 'Total', 'sportspress' ), 'venue' => __( 'Venue', 'sportspress' ), 'view_all_events' => __( 'View all events', 'sportspress' ), diff --git a/templates/event-list.php b/templates/event-list.php index 87f49b20..b2b3837c 100644 --- a/templates/event-list.php +++ b/templates/event-list.php @@ -49,7 +49,7 @@ if ( isset( $columns ) ) echo '' . SP()->text->string('Teams') . ''; if ( $usecolumns == null || in_array( 'time', $usecolumns ) ) - echo '' . SP()->text->string('Time') . ''; + echo '' . SP()->text->string('Time/Results') . ''; if ( $usecolumns == null || in_array( 'venue', $usecolumns ) ) echo '' . SP()->text->string('Venue') . ''; @@ -71,6 +71,7 @@ if ( isset( $columns ) ) $teams = get_post_meta( $event->ID, 'sp_team' ); $results = get_post_meta( $event->ID, 'sp_results', true ); + $main_results = array(); $video = get_post_meta( $event->ID, 'sp_video', true ); echo ''; @@ -104,6 +105,7 @@ if ( isset( $columns ) ) echo $name; if ( $team_result != null ): + $main_results[] = $team_result; echo ' (' . $team_result . ')'; endif; @@ -117,8 +119,15 @@ if ( isset( $columns ) ) echo ''; endif; - if ( $usecolumns == null || in_array( 'time', $usecolumns ) ) - echo '' . get_post_time( get_option( 'time_format' ), false, $event ) . ''; + if ( $usecolumns == null || in_array( 'time', $usecolumns ) ): + echo ''; + if ( ! empty( $main_results ) ): + echo implode( ' - ', $main_results ); + else: + echo get_post_time( get_option( 'time_format' ), false, $event ); + endif; + echo ''; + endif; if ( $usecolumns == null || in_array( 'venue', $usecolumns ) ): echo '';