From ea093cba6f24d7eacee6f92d705c9d838cb1f4c6 Mon Sep 17 00:00:00 2001 From: Nabil Kadimi Date: Thu, 13 Sep 2018 17:40:47 +0100 Subject: [PATCH 1/3] Allow overriding team events list template arguments --- templates/team-events.php | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-) diff --git a/templates/team-events.php b/templates/team-events.php index c63ed084..f8127582 100644 --- a/templates/team-events.php +++ b/templates/team-events.php @@ -15,8 +15,8 @@ if ( ! isset( $id ) ) $format = get_option( 'sportspress_team_events_format', 'blocks' ); if ( 'calendar' === $format ) sp_get_template( 'event-calendar.php', array( 'team' => $id ) ); -elseif ( 'list' === $format ) - sp_get_template( 'event-list.php', array( +elseif ( 'list' === $format ) { + $args = array( 'team' => $id, 'league' => apply_filters( 'sp_team_events_league', 0 ), 'season' => apply_filters( 'sp_team_events_season', 0 ), @@ -24,6 +24,8 @@ elseif ( 'list' === $format ) 'time_format' => 'separate', 'columns' => array( 'event', 'time', 'results' ), 'order' => 'DESC', - ) ); -else + ); + $args = apply_filters( 'sportspress_team_events_list_args', $args ); + sp_get_template( 'event-list.php', $args ); +} else sp_get_template( 'event-fixtures-results.php', array( 'team' => $id ) ); From 672e1165263ca2e742bcbfc48763bd84da4185e9 Mon Sep 17 00:00:00 2001 From: Nabil Kadimi Date: Thu, 13 Sep 2018 17:42:36 +0100 Subject: [PATCH 2/3] Refactor using WordPress brace style https://make.wordpress.org/core/handbook/best-practices/coding-standards/php/#brace-style --- templates/team-events.php | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/templates/team-events.php b/templates/team-events.php index f8127582..016b9800 100644 --- a/templates/team-events.php +++ b/templates/team-events.php @@ -13,8 +13,9 @@ if ( ! isset( $id ) ) $id = get_the_ID(); $format = get_option( 'sportspress_team_events_format', 'blocks' ); -if ( 'calendar' === $format ) +if ( 'calendar' === $format ) { sp_get_template( 'event-calendar.php', array( 'team' => $id ) ); +} elseif ( 'list' === $format ) { $args = array( 'team' => $id, @@ -27,5 +28,6 @@ elseif ( 'list' === $format ) { ); $args = apply_filters( 'sportspress_team_events_list_args', $args ); sp_get_template( 'event-list.php', $args ); -} else +} else { sp_get_template( 'event-fixtures-results.php', array( 'team' => $id ) ); +} From e504217d0c4c56d15dde8403f8b29da098fa411a Mon Sep 17 00:00:00 2001 From: Nabil Kadimi Date: Tue, 2 Oct 2018 23:13:47 +0100 Subject: [PATCH 3/3] Use sp_ for the new hook --- templates/team-events.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/templates/team-events.php b/templates/team-events.php index 016b9800..dafbd35f 100644 --- a/templates/team-events.php +++ b/templates/team-events.php @@ -26,7 +26,7 @@ elseif ( 'list' === $format ) { 'columns' => array( 'event', 'time', 'results' ), 'order' => 'DESC', ); - $args = apply_filters( 'sportspress_team_events_list_args', $args ); + $args = apply_filters( 'sp_team_events_list_args', $args ); sp_get_template( 'event-list.php', $args ); } else { sp_get_template( 'event-fixtures-results.php', array( 'team' => $id ) );