From ef57de9eab73ac251bdf777ab53de970bb4aafb9 Mon Sep 17 00:00:00 2001 From: Brian Miyaji Date: Fri, 8 Apr 2016 15:28:31 +1000 Subject: [PATCH] Load league table and player list option in teams --- includes/class-sp-templates.php | 12 ------------ modules/sportspress-league-tables.php | 17 +++++++++++++++++ modules/sportspress-player-lists.php | 17 +++++++++++++++++ 3 files changed, 34 insertions(+), 12 deletions(-) diff --git a/includes/class-sp-templates.php b/includes/class-sp-templates.php index 3015247a..3a95aacb 100644 --- a/includes/class-sp-templates.php +++ b/includes/class-sp-templates.php @@ -146,18 +146,6 @@ class SP_Templates { 'action' => 'sportspress_output_team_staff', 'default' => 'yes', ), - 'lists' => array( - 'title' => __( 'Player Lists', 'sportspress' ), - 'option' => 'sportspress_team_show_lists', - 'action' => 'sportspress_output_team_lists', - 'default' => 'yes', - ), - 'tables' => array( - 'title' => __( 'League Tables', 'sportspress' ), - 'option' => 'sportspress_team_show_tables', - 'action' => 'sportspress_output_team_tables', - 'default' => 'yes', - ), ) ) ), 'table' => array_merge( diff --git a/modules/sportspress-league-tables.php b/modules/sportspress-league-tables.php index 5b60b8aa..f1165a5a 100644 --- a/modules/sportspress-league-tables.php +++ b/modules/sportspress-league-tables.php @@ -39,6 +39,7 @@ class SportsPress_League_Tables { add_filter( 'sportspress_shortcodes', array( $this, 'add_shortcodes' ) ); add_filter( 'sportspress_team_settings', array( $this, 'add_settings' ) ); add_filter( 'sportspress_team_options', array( $this, 'add_options' ) ); + add_filter( 'sportspress_after_team_template', array( $this, 'add_team_template' ), 30 ); } /** @@ -260,6 +261,22 @@ class SportsPress_League_Tables { ) ); } + + /** + * Add team template. + * + * @return array + */ + public function add_team_template( $templates ) { + return array_merge( $templates, array( + 'tables' => array( + 'title' => __( 'League Tables', 'sportspress' ), + 'option' => 'sportspress_team_show_tables', + 'action' => 'sportspress_output_team_tables', + 'default' => 'yes', + ), + ) ); + } } endif; diff --git a/modules/sportspress-player-lists.php b/modules/sportspress-player-lists.php index 0ba4ed58..49bcbf01 100644 --- a/modules/sportspress-player-lists.php +++ b/modules/sportspress-player-lists.php @@ -38,6 +38,7 @@ class SportsPress_Player_Lists { add_filter( 'sportspress_meta_boxes', array( $this, 'add_meta_boxes' ) ); add_filter( 'sportspress_shortcodes', array( $this, 'add_shortcodes' ) ); add_filter( 'sportspress_player_settings', array( $this, 'add_settings' ) ); + add_filter( 'sportspress_after_team_template', array( $this, 'add_team_template' ), 20 ); } /** @@ -249,6 +250,22 @@ class SportsPress_Player_Lists { ) ) ); } + + /** + * Add team template. + * + * @return array + */ + public function add_team_template( $templates ) { + return array_merge( $templates, array( + 'lists' => array( + 'title' => __( 'Player Lists', 'sportspress' ), + 'option' => 'sportspress_team_show_lists', + 'action' => 'sportspress_output_team_lists', + 'default' => 'yes', + ), + ) ); + } } endif;