diff --git a/assets/css/admin.css b/assets/css/admin.css
index 823db4e9..0ac2459a 100644
--- a/assets/css/admin.css
+++ b/assets/css/admin.css
@@ -595,6 +595,129 @@ table.widefat.sp-sortable-table tbody tr .icon {
border-left-color: #464646;
}
+/* Toggle switches */
+.sp-toggle-switch {
+ display: none !important;
+}
+
+.sp-toggle-switch + label {
+ width: 40px;
+ height: 20px;
+ border-radius: 20px;
+ position: absolute;
+ right: 10px;
+ top: 11px;
+}
+
+.sp-toggle-switch + label:before,
+.sp-toggle-switch + label:after {
+ display: block;
+ position: absolute;
+ top: 0;
+ left: 0;
+ bottom: 0;
+ content: "";
+}
+
+.sp-toggle-switch + label:before {
+ right: 1px;
+ background-color: #e4e4e4;
+ border-radius: 20px;
+ transition: background 0.4s;
+}
+
+.sp-toggle-switch + label:after {
+ width: 20px;
+ background-color: #fff;
+ border-radius: 100%;
+ -webkit-box-shadow: 0 2px 5px rgba(0, 0, 0, 0.2);
+ box-shadow: 0 2px 5px rgba(0, 0, 0, 0.2);
+ transition: margin 0.4s;
+}
+
+.sp-toggle-switch:checked + label:before {
+ background-color: #00a0d2;
+}
+
+.sp-toggle-switch:checked + label:after {
+ margin-left: 20px;
+}
+
+.sp-toggle-switch:checked + label:hover:before {
+ background-color: #00b9eb;
+}
+
+/* Sortable lists */
+.sp-sortable-list li {
+ float: left;
+ clear: both;
+ max-width: 382px;
+ width: 100%;
+ box-sizing: border-box;
+}
+
+.sp-sortable-list .sp-item-float + .sp-item-float {
+ padding-right: 0;
+}
+
+.sp-item-bar {
+ clear: both;
+ line-height: 1.5em;
+ position: relative;
+ margin: 9px 0 0;
+}
+
+.sp-item-bar .sp-item-handle {
+ background: #fafafa;
+ color: #23282d;
+ border: 1px solid #dfdfdf;
+ position: relative;
+ padding: 10px 15px;
+ height: auto;
+ min-height: 20px;
+ line-height: 30px;
+ overflow: hidden;
+ word-wrap: break-word;
+}
+
+.sp-item-bar .sp-item-handle:hover {
+ border-color: #999;
+ -webkit-box-shadow: 0 1px 2px rgba(0,0,0,.1);
+ box-shadow: 0 1px 2px rgba(0,0,0,.1);
+}
+
+.sp-item-bar .sp-item-title {
+ font-size: 13px;
+ font-weight: 600;
+ line-height: 20px;
+ display: block;
+ margin-right: 13em;
+}
+
+.sp-item-settings {
+ display: block;
+ padding: 10px 0 10px 15px;
+ position: relative;
+ z-index: 10;
+ background: #fff;
+ border: 1px solid #e5e5e5;
+ border-top: none;
+ -webkit-box-shadow: 0 1px 1px rgba(0,0,0,.04);
+ box-shadow: 0 1px 1px rgba(0,0,0,.04);
+}
+
+.js .sp-item-handle {
+ cursor: move;
+}
+
+.sp-sortable-list .sp-item-placeholder {
+ border: 1px dashed #b4b9be;
+ margin: 9px auto 6px;
+ height: 42px;
+}
+
+/* Modules */
+
.sp-modules-wrapper {
margin-top: 20px;
margin-right: 300px;
diff --git a/assets/js/admin/sportspress-admin.js b/assets/js/admin/sportspress-admin.js
index 293bdb4b..5d85e537 100644
--- a/assets/js/admin/sportspress-admin.js
+++ b/assets/js/admin/sportspress-admin.js
@@ -291,6 +291,12 @@ jQuery(document).ready(function($){
handle: ".icon",
axis: "y"
});
+
+ // Sortable lists
+ $( ".sp-sortable-list" ).sortable({
+ handle: ".sp-item-handle",
+ placeholder: "sp-item-placeholder"
+ });
// Autosave
$(".sp-autosave").change(function() {
diff --git a/includes/admin/settings/class-sp-settings-events.php b/includes/admin/settings/class-sp-settings-events.php
index 013a524f..8835e2fc 100644
--- a/includes/admin/settings/class-sp-settings-events.php
+++ b/includes/admin/settings/class-sp-settings-events.php
@@ -23,11 +23,15 @@ class SP_Settings_Events extends SP_Settings_Page {
public function __construct() {
$this->id = 'events';
$this->label = __( 'Events', 'sportspress' );
+
+ $this->template = 'event';
+ $this->templates = SP()->templates->event;
add_filter( 'sportspress_settings_tabs_array', array( $this, 'add_settings_page' ), 20 );
add_action( 'sportspress_settings_' . $this->id, array( $this, 'output' ) );
add_action( 'sportspress_admin_field_current_mode', array( $this, 'current_mode_setting' ) );
add_action( 'sportspress_admin_field_delimiter', array( $this, 'delimiter_setting' ) );
+ add_action( 'sportspress_admin_field_event_layout', array( $this, 'layout_setting' ) );
add_action( 'sportspress_settings_save_' . $this->id, array( $this, 'save' ) );
}
@@ -55,20 +59,15 @@ class SP_Settings_Events extends SP_Settings_Page {
),
apply_filters( 'sportspress_event_template_options', array(
+ array( 'type' => 'event_layout' ),
+
array(
'title' => __( 'Display', 'sportspress' ),
- 'desc' => __( 'Logos', 'sportspress' ),
- 'id' => 'sportspress_event_show_logos',
- 'default' => 'yes',
- 'type' => 'checkbox',
- 'checkboxgroup' => 'start',
- ),
- array(
'desc' => __( 'Date', 'sportspress' ),
'id' => 'sportspress_event_show_date',
'default' => 'yes',
'type' => 'checkbox',
- 'checkboxgroup' => '',
+ 'checkboxgroup' => 'start',
),
array(
'desc' => __( 'Time', 'sportspress' ),
@@ -77,34 +76,6 @@ class SP_Settings_Events extends SP_Settings_Page {
'type' => 'checkbox',
'checkboxgroup' => '',
),
- array(
- 'desc' => __( 'Results', 'sportspress' ),
- 'id' => 'sportspress_event_show_results',
- 'default' => 'yes',
- 'type' => 'checkbox',
- 'checkboxgroup' => '',
- ),
- array(
- 'desc' => __( 'Details', 'sportspress' ),
- 'id' => 'sportspress_event_show_details',
- 'default' => 'yes',
- 'type' => 'checkbox',
- 'checkboxgroup' => '',
- ),
- array(
- 'desc' => __( 'Venue', 'sportspress' ),
- 'id' => 'sportspress_event_show_venue',
- 'default' => 'yes',
- 'type' => 'checkbox',
- 'checkboxgroup' => '',
- ),
- array(
- 'desc' => __( 'Scorecard', 'sportspress' ),
- 'id' => 'sportspress_event_show_performance',
- 'default' => 'yes',
- 'type' => 'checkbox',
- 'checkboxgroup' => 'end',
- ),
) ),
array(
@@ -421,8 +392,7 @@ class SP_Settings_Events extends SP_Settings_Page {
* Save settings
*/
public function save() {
- $settings = $this->get_settings();
- SP_Admin_Settings::save_fields( $settings );
+ parent::save();
if ( isset( $_POST['sportspress_event_teams_delimiter'] ) )
update_option( 'sportspress_event_teams_delimiter', $_POST['sportspress_event_teams_delimiter'] );
diff --git a/includes/admin/settings/class-sp-settings-page.php b/includes/admin/settings/class-sp-settings-page.php
index 3e155a0e..834c0d21 100644
--- a/includes/admin/settings/class-sp-settings-page.php
+++ b/includes/admin/settings/class-sp-settings-page.php
@@ -19,7 +19,8 @@ class SP_Settings_Page {
protected $id = '';
protected $label = '';
-
+ protected $template = '';
+ public $templates = array();
/**
* Add this page to settings
*/
@@ -56,8 +57,69 @@ class SP_Settings_Page {
$settings = $this->get_settings();
SP_Admin_Settings::save_fields( $settings );
- if ( $current_section )
- do_action( 'sportspress_update_options_' . $this->id . '_' . $current_section );
+ if ( $current_section )
+ do_action( 'sportspress_update_options_' . $this->template . '_' . $current_section );
+
+ if ( ! empty( $this->templates ) )
+ update_option( 'sportspress_' . $this->template . '_template_order', sp_array_value( $_POST, 'sportspress_' . $this->template . '_template_order', false ) );
+
+ if ( isset( $_POST['sportspress_template_visibility'] ) && is_array( $_POST['sportspress_template_visibility'] ) ) {
+ foreach ( $_POST['sportspress_template_visibility'] as $option => $toggled ) {
+ if ( $toggled ) {
+ update_option( $option, 'yes' );
+ } else {
+ update_option( $option, 'no' );
+ }
+ }
+ }
+
+ }
+
+ /**
+ * Layout settings
+ *
+ * @access public
+ * @return void
+ */
+ public function layout_setting() {
+ $templates = apply_filters( 'sportspress_' . $this->template . '_templates', $this->templates );
+
+ $layout = get_option( 'sportspress_' . $this->template . '_template_order' );
+ if ( false === $layout ) {
+ $layout = array_keys( $templates );
+ }
+
+ $templates = array_merge( array_flip( $layout ), $templates );
+ ?>
+
+ |
+
+ |
+
+
+
+
+ $details ) {
+ $option = sp_array_value( $details, 'option', 'sportspress_' . $this->template . '_show_' . $template );
+ $visibility = get_option( $option, sp_array_value( $details, 'default', 'yes' ) );
+ ?>
+ -
+
+
+
+
+ |
+
+ id = 'players';
$this->label = __( 'Players', 'sportspress' );
+
+ $this->template = 'player';
+ $this->templates = SP()->templates->player;
add_filter( 'sportspress_settings_tabs_array', array( $this, 'add_settings_page' ), 20 );
add_action( 'sportspress_settings_' . $this->id, array( $this, 'output' ) );
+ add_action( 'sportspress_admin_field_player_layout', array( $this, 'layout_setting' ) );
add_action( 'sportspress_settings_save_' . $this->id, array( $this, 'save' ) );
}
@@ -37,12 +41,13 @@ class SP_Settings_Players extends SP_Settings_Page {
public function get_settings() {
$settings = array_merge(
-
array(
array( 'title' => __( 'Player Options', 'sportspress' ), 'type' => 'title','desc' => '', 'id' => 'player_options' ),
),
apply_filters( 'sportspress_player_options', array(
+ array( 'type' => 'player_layout' ),
+
array(
'title' => __( 'Link', 'sportspress' ),
'desc' => __( 'Link players', 'sportspress' ),
@@ -51,39 +56,6 @@ class SP_Settings_Players extends SP_Settings_Page {
'type' => 'checkbox',
),
- array(
- 'title' => __( 'Display', 'sportspress' ),
- 'desc' => __( 'Photo', 'sportspress' ),
- 'id' => 'sportspress_player_show_photo',
- 'default' => 'yes',
- 'type' => 'checkbox',
- 'checkboxgroup' => 'start',
- ),
-
- array(
- 'desc' => __( 'Details', 'sportspress' ),
- 'id' => 'sportspress_player_show_details',
- 'default' => 'yes',
- 'type' => 'checkbox',
- 'checkboxgroup' => '',
- ),
-
- array(
- 'desc' => __( 'Statistics', 'sportspress' ),
- 'id' => 'sportspress_player_show_statistics',
- 'default' => 'yes',
- 'type' => 'checkbox',
- 'checkboxgroup' => '',
- ),
-
- array(
- 'desc' => __( 'Total', 'sportspress' ),
- 'id' => 'sportspress_player_show_total',
- 'default' => 'no',
- 'type' => 'checkbox',
- 'checkboxgroup' => 'end',
- ),
-
array(
'title' => __( 'Details', 'sportspress' ),
'desc' => __( 'Nationality', 'sportspress' ),
@@ -156,6 +128,14 @@ class SP_Settings_Players extends SP_Settings_Page {
),
),
+ array(
+ 'title' => __( 'Total', 'sportspress' ),
+ 'desc' => __( 'Display total', 'sportspress' ),
+ 'id' => 'sportspress_player_show_total',
+ 'default' => 'no',
+ 'type' => 'checkbox',
+ ),
+
array(
'title' => __( 'Nationality', 'sportspress' ),
'desc' => __( 'Display national flags', 'sportspress' ),
diff --git a/includes/admin/settings/class-sp-settings-teams.php b/includes/admin/settings/class-sp-settings-teams.php
index 58df6d0d..794056d2 100644
--- a/includes/admin/settings/class-sp-settings-teams.php
+++ b/includes/admin/settings/class-sp-settings-teams.php
@@ -23,9 +23,13 @@ class SP_Settings_Teams extends SP_Settings_Page {
public function __construct() {
$this->id = 'teams';
$this->label = __( 'Teams', 'sportspress' );
+
+ $this->template = 'team';
+ $this->templates = SP()->templates->team;
add_filter( 'sportspress_settings_tabs_array', array( $this, 'add_settings_page' ), 20 );
add_action( 'sportspress_settings_' . $this->id, array( $this, 'output' ) );
+ add_action( 'sportspress_admin_field_team_layout', array( $this, 'layout_setting' ) );
add_action( 'sportspress_settings_save_' . $this->id, array( $this, 'save' ) );
}
@@ -43,6 +47,8 @@ class SP_Settings_Teams extends SP_Settings_Page {
),
apply_filters( 'sportspress_team_options', array(
+ array( 'type' => 'team_layout' ),
+
array(
'title' => __( 'Link', 'sportspress' ),
'desc' => __( 'Link teams', 'sportspress' ),
@@ -51,31 +57,6 @@ class SP_Settings_Teams extends SP_Settings_Page {
'type' => 'checkbox',
),
- array(
- 'title' => __( 'Display', 'sportspress' ),
- 'desc' => __( 'Logo', 'sportspress' ),
- 'id' => 'sportspress_team_show_logo',
- 'default' => 'yes',
- 'type' => 'checkbox',
- 'checkboxgroup' => 'start',
- ),
-
- array(
- 'desc' => __( 'Details', 'sportspress' ),
- 'id' => 'sportspress_team_show_details',
- 'default' => 'no',
- 'type' => 'checkbox',
- 'checkboxgroup' => '',
- ),
-
- array(
- 'desc' => __( 'Visit Site', 'sportspress' ),
- 'id' => 'sportspress_team_show_link',
- 'default' => 'yes',
- 'type' => 'checkbox',
- 'checkboxgroup' => 'end',
- ),
-
array(
'title' => __( 'Venue', 'sportspress' ),
'desc' => __( 'Link venues', 'sportspress' ),
diff --git a/includes/class-sp-template-loader.php b/includes/class-sp-template-loader.php
index ac48b259..7f1fd7af 100644
--- a/includes/class-sp-template-loader.php
+++ b/includes/class-sp-template-loader.php
@@ -24,10 +24,17 @@ class SP_Template_Loader {
add_filter( 'the_content', array( $this, 'staff_content' ) );
}
- public function add_content( $content, $template, $position = 10, $caption = null ) {
+ public function add_content( $content, $type, $position = 10, $caption = null ) {
if ( ! defined( 'ABSPATH' ) ) exit; // Exit if accessed directly
if ( ! in_the_loop() ) return; // Return if not in main loop
+ // Return password form if required
+ if ( post_password_required() ) {
+ echo get_the_password_form();
+ return;
+ }
+
+ // Prepend caption to content if given
if ( $content ) {
if ( $caption ) {
$content = '' . $caption . '
' . $content;
@@ -36,30 +43,51 @@ class SP_Template_Loader {
$content = '' . $content . '
';
}
- ob_start();
-
- if ( post_password_required() ) {
- echo get_the_password_form();
- return;
+ global $wp_filter;
+
+ // Array of hooks associated with this post type
+ $hooks = array(
+ 'sportspress_before_single_' . $type,
+ 'sportspress_single_' . $type . '_content',
+ 'sportspress_after_single_' . $type,
+ );
+
+ $actions = array();
+
+ // Find all actions associated with those hooks
+ foreach ( $hooks as $hook ) {
+ $priorities = sp_array_value( $wp_filter, $hook, array() );
+
+ foreach ( $priorities as $priority => $action ) {
+ $a = reset( $action );
+ $function = sp_array_value( $a, 'function', false );
+ remove_action( $hook, $function, $priority );
+ $actions[] = $function;
+ }
}
+
+ // Get layout setting
+ $layout = (array) get_option( 'sportspress_' . $type . '_template_order', array() );
+
+ // Combine layout setting with available templates
+ $templates = array_merge( array_flip( $layout ), SP()->templates->$type );
- if ( $position <= 0 )
- echo $content;
-
- do_action( 'sportspress_before_single_' . $template );
-
- if ( $position > 0 && $position <= 10 )
- echo $content;
-
- do_action( 'sportspress_single_' . $template . '_content' );
-
- if ( $position > 10 && $position <= 20 )
- echo $content;
-
- do_action( 'sportspress_after_single_' . $template );
-
- if ( $position > 20 )
- echo $content;
+ ob_start();
+
+ // Loop through templates
+ foreach ( $templates as $key => $template ) {
+ // Ignore templates that are unavailable or that have been turned off
+ if ( ! is_array( $template ) ) continue;
+ if ( ! isset( $template['option'] ) ) continue;
+ if ( 'yes' !== get_option( $template['option'], sp_array_value( $template, 'default', 'yes' ) ) ) continue;
+
+ // Render the template
+ if ( 'content' === $key ) {
+ echo $content;
+ } else {
+ call_user_func( $template['action'] );
+ }
+ }
return ob_get_clean();
}
diff --git a/includes/class-sp-templates.php b/includes/class-sp-templates.php
new file mode 100644
index 00000000..7e9cf82f
--- /dev/null
+++ b/includes/class-sp-templates.php
@@ -0,0 +1,288 @@
+data = array(
+ 'event' => array_merge(
+ apply_filters( 'sportspress_before_event_template', array(
+ 'logos' => array(
+ 'title' => __( 'Logos', 'sportspress' ),
+ 'option' => 'sportspress_event_show_logos',
+ 'action' => 'sportspress_output_event_logos',
+ 'default' => 'yes',
+ ),
+ 'excerpt' => array(
+ 'title' => __( 'Excerpt', 'sportspress' ),
+ 'option' => 'sportspress_event_show_excerpt',
+ 'action' => 'sportspress_output_post_excerpt',
+ 'default' => 'yes',
+ ),
+ ) ),
+
+ array(
+ 'content' => array(
+ 'title' => __( 'Article', 'sportspress' ),
+ 'option' => 'sportspress_event_show_content',
+ 'action' => 'sportspress_output_event_content',
+ 'default' => 'yes',
+ ),
+ ),
+
+ apply_filters( 'sportspress_after_event_template', array(
+ 'video' => array(
+ 'title' => __( 'Video', 'sportspress' ),
+ 'option' => 'sportspress_event_show_video',
+ 'action' => 'sportspress_output_event_video',
+ 'default' => 'yes',
+ ),
+ 'details' => array(
+ 'title' => __( 'Details', 'sportspress' ),
+ 'option' => 'sportspress_event_show_details',
+ 'action' => 'sportspress_output_event_details',
+ 'default' => 'yes',
+ ),
+ 'venue' => array(
+ 'title' => __( 'Venue', 'sportspress' ),
+ 'option' => 'sportspress_event_show_venue',
+ 'action' => 'sportspress_output_event_venue',
+ 'default' => 'yes',
+ ),
+ 'results' => array(
+ 'title' => __( 'Results', 'sportspress' ),
+ 'option' => 'sportspress_event_show_results',
+ 'action' => 'sportspress_output_event_results',
+ 'default' => 'yes',
+ ),
+ 'performance' => array(
+ 'title' => __( 'Scorecard', 'sportspress' ),
+ 'option' => 'sportspress_event_show_performance',
+ 'action' => 'sportspress_output_event_performance',
+ 'default' => 'yes',
+ ),
+ ) )
+ ),
+ 'calendar' => array_merge(
+ apply_filters( 'sportspress_before_calendar_template', array() ),
+
+ array(
+ 'content' => array(
+ 'title' => __( 'Description', 'sportspress' ),
+ 'option' => 'sportspress_calendar_show_content',
+ 'action' => 'sportspress_output_calendar_content',
+ 'default' => 'yes',
+ ),
+ ),
+
+ apply_filters( 'sportspress_after_calendar_template', array(
+ 'data' => array(
+ 'title' => __( 'Calendar', 'sportspress' ),
+ 'option' => 'sportspress_calendar_show_data',
+ 'action' => 'sportspress_output_calendar',
+ 'default' => 'yes',
+ ),
+ ) )
+ ),
+ 'team' => array_merge(
+ apply_filters( 'sportspress_before_team_template', array(
+ 'logo' => array(
+ 'title' => __( 'Logo', 'sportspress' ),
+ 'option' => 'sportspress_team_show_logo',
+ 'action' => 'sportspress_output_team_logo',
+ 'default' => 'yes',
+ ),
+ 'excerpt' => array(
+ 'title' => __( 'Excerpt', 'sportspress' ),
+ 'option' => 'sportspress_team_show_excerpt',
+ 'action' => 'sportspress_output_post_excerpt',
+ 'default' => 'yes',
+ ),
+ ) ),
+
+ array(
+ 'content' => array(
+ 'title' => __( 'Profile', 'sportspress' ),
+ 'option' => 'sportspress_team_show_content',
+ 'action' => 'sportspress_output_team_content',
+ 'default' => 'yes',
+ ),
+ ),
+
+ apply_filters( 'sportspress_after_team_template', array(
+ 'link' => array(
+ 'title' => __( 'Visit Site', 'sportspress' ),
+ 'option' => 'sportspress_team_show_link',
+ 'action' => 'sportspress_output_team_link',
+ 'default' => 'no',
+ ),
+ 'details' => array(
+ 'title' => __( 'Details', 'sportspress' ),
+ 'option' => 'sportspress_team_show_details',
+ 'action' => 'sportspress_output_team_details',
+ 'default' => 'no',
+ ),
+ 'staff' => array(
+ 'title' => __( 'Staff', 'sportspress' ),
+ 'option' => 'sportspress_team_show_staff',
+ '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(
+ apply_filters( 'sportspress_before_table_template', array() ),
+
+ array(
+ 'content' => array(
+ 'title' => __( 'Description', 'sportspress' ),
+ 'option' => 'sportspress_table_show_content',
+ 'action' => 'sportspress_output_table_content',
+ 'default' => 'yes',
+ ),
+ ),
+
+ apply_filters( 'sportspress_after_table_template', array(
+ 'data' => array(
+ 'title' => __( 'League Table', 'sportspress' ),
+ 'option' => 'sportspress_table_show_data',
+ 'action' => 'sportspress_output_league_table',
+ 'default' => 'yes',
+ ),
+ ) )
+ ),
+ 'player' => array_merge(
+ apply_filters( 'sportspress_before_player_template', array(
+ 'photo' => array(
+ 'title' => __( 'Photo', 'sportspress' ),
+ 'option' => 'sportspress_player_show_photo',
+ 'action' => 'sportspress_output_player_photo',
+ 'default' => 'yes',
+ ),
+ 'details' => array(
+ 'title' => __( 'Details', 'sportspress' ),
+ 'option' => 'sportspress_player_show_details',
+ 'action' => 'sportspress_output_player_details',
+ 'default' => 'yes',
+ ),
+ 'excerpt' => array(
+ 'title' => __( 'Excerpt', 'sportspress' ),
+ 'option' => 'sportspress_player_show_excerpt',
+ 'action' => 'sportspress_output_post_excerpt',
+ 'default' => 'yes',
+ ),
+ ) ),
+
+ array(
+ 'content' => array(
+ 'title' => __( 'Profile', 'sportspress' ),
+ 'option' => 'sportspress_player_show_content',
+ 'action' => 'sportspress_output_player_content',
+ 'default' => 'yes',
+ ),
+ ),
+
+ apply_filters( 'sportspress_after_player_template', array(
+ 'statistics' => array(
+ 'title' => __( 'Statistics', 'sportspress' ),
+ 'option' => 'sportspress_player_show_statistics',
+ 'action' => 'sportspress_output_player_statistics',
+ 'default' => 'yes',
+ ),
+ ) )
+ ),
+ 'list' => array_merge(
+ apply_filters( 'sportspress_before_list_template', array() ),
+
+ array(
+ 'content' => array(
+ 'title' => __( 'Description', 'sportspress' ),
+ 'option' => 'sportspress_list_show_content',
+ 'action' => 'sportspress_output_list_content',
+ 'default' => 'yes',
+ ),
+ ),
+
+ apply_filters( 'sportspress_after_list_template', array(
+ 'data' => array(
+ 'title' => __( 'Player List', 'sportspress' ),
+ 'option' => 'sportspress_list_show_data',
+ 'action' => 'sportspress_output_player_list',
+ 'default' => 'yes',
+ ),
+ ) )
+ ),
+ 'staff' => array_merge(
+ apply_filters( 'sportspress_before_staff_template', array(
+ 'photo' => array(
+ 'title' => __( 'Photo', 'sportspress' ),
+ 'option' => 'sportspress_staff_show_photo',
+ 'action' => 'sportspress_output_staff_photo',
+ 'default' => 'yes',
+ ),
+ 'details' => array(
+ 'title' => __( 'Details', 'sportspress' ),
+ 'option' => 'sportspress_staff_show_details',
+ 'action' => 'sportspress_output_staff_details',
+ 'default' => 'yes',
+ ),
+ 'excerpt' => array(
+ 'title' => __( 'Excerpt', 'sportspress' ),
+ 'option' => 'sportspress_staff_show_excerpt',
+ 'action' => 'sportspress_output_post_excerpt',
+ 'default' => 'yes',
+ ),
+ ) ),
+
+ array(
+ 'content' => array(
+ 'title' => __( 'Profile', 'sportspress' ),
+ 'option' => 'sportspress_staff_show_content',
+ 'action' => 'sportspress_output_staff_content',
+ 'default' => 'yes',
+ ),
+ ),
+
+ apply_filters( 'sportspress_after_staff_template', array() )
+ ),
+ );
+ }
+
+ public function __get( $key ) {
+ return ( array_key_exists( $key, $this->data ) ? $this->data[ $key ] : array() );
+ }
+
+ public function __set( $key, $value ){
+ $this->data[ $key ] = $value;
+ }
+}
diff --git a/includes/sp-template-hooks.php b/includes/sp-template-hooks.php
index 56fa3422..f018ea2a 100644
--- a/includes/sp-template-hooks.php
+++ b/includes/sp-template-hooks.php
@@ -82,12 +82,6 @@ add_action( 'sportspress_single_team_content', 'sportspress_output_team_staff',
add_action( 'sportspress_single_team_content', 'sportspress_output_team_lists', 20 );
add_action( 'sportspress_single_team_content', 'sportspress_output_team_tables', 30 );
-/**
- * Before Single Table
- * @see sportspress_output_post_excerpt()
- */
-add_action( 'sportspress_before_single_table', 'sportspress_output_post_excerpt', 20 );
-
/**
* Single Table Content
*
diff --git a/sportspress.php b/sportspress.php
index 20b843c4..8eccd56e 100644
--- a/sportspress.php
+++ b/sportspress.php
@@ -56,6 +56,11 @@ final class SportsPress {
*/
public $formats = null;
+ /**
+ * @var SP_Templates $templates
+ */
+ public $templates = null;
+
/**
* @var array
*/
@@ -223,6 +228,7 @@ final class SportsPress {
include_once( 'includes/class-sp-modules.php' ); // Defines available modules
include_once( 'includes/class-sp-countries.php' ); // Defines continents and countries
include_once( 'includes/class-sp-formats.php' ); // Defines custom post type formats
+ include_once( 'includes/class-sp-templates.php' ); // Defines custom post type templates
include_once( 'includes/class-sp-feeds.php' ); // Adds feeds
// Include template functions making them pluggable by plugins and themes.
@@ -288,6 +294,7 @@ final class SportsPress {
$this->modules = new SP_Modules(); // Modules class
$this->countries = new SP_Countries(); // Countries class
$this->formats = new SP_Formats(); // Formats class
+ $this->templates = new SP_Templates(); // Templates class
$this->feeds = new SP_Feeds(); // Feeds class
// Load string options