diff --git a/assets/js/admin/sportspress-admin.js b/assets/js/admin/sportspress-admin.js
index 378e67de..802601b5 100644
--- a/assets/js/admin/sportspress-admin.js
+++ b/assets/js/admin/sportspress-admin.js
@@ -366,4 +366,13 @@ jQuery(document).ready(function($){
$this.find('strong').html(event.strftime("%D "+localized_strings.days+" %H:%M:%S"));
});
});
+
+ // Configure primary result option
+ $( ".sp-admin-config-table" ).on( "click", ".sp-primary-result-option", function() {
+ $.post( ajaxurl, {
+ action: "sp-save-primary-result",
+ primary_result: $(this).val(),
+ nonce: $("#sp-config-nonce").val()
+ });
+ });
});
\ No newline at end of file
diff --git a/includes/admin/class-sp-admin-ajax.php b/includes/admin/class-sp-admin-ajax.php
new file mode 100644
index 00000000..962f241e
--- /dev/null
+++ b/includes/admin/class-sp-admin-ajax.php
@@ -0,0 +1,39 @@
+output();
}
- /**
- * Init the addons page
- */
- public function addons_page() {
- $page = include( 'class-sp-admin-addons.php' );
- $page->output();
- }
-
/**
* Clean the SP menu items in admin.
*/
@@ -242,8 +233,14 @@ class SP_Admin_Menus {
* Init the overview page
*/
public function overview_page() {
- include_once( 'class-sp-admin-overview.php' );
- SP_Admin_Overview::output();
+ include( 'views/html-admin-overview.php' );
+ }
+
+ /**
+ * Init the config page
+ */
+ public function config_page() {
+ include( 'views/html-admin-config.php' );
}
/**
@@ -279,6 +276,16 @@ class SP_Admin_Menus {
$parent_file = $p;
$submenu_file = $s;
}
+
+ public static function sitemap_taxonomy_post_types( $post_types = array(), $taxonomy ) {
+ $post_types = array_intersect( $post_types, sp_primary_post_types() );
+ // Remove teams from venues taxonomy post type array
+ if ( ( $key = array_search( 'sp_team', $post_types ) ) !== false ):
+ unset( $post_types[ $key ] );
+ endif;
+
+ return $post_types;
+ }
}
endif;
diff --git a/includes/admin/class-sp-admin-settings.php b/includes/admin/class-sp-admin-settings.php
index fc634123..70de5878 100644
--- a/includes/admin/class-sp-admin-settings.php
+++ b/includes/admin/class-sp-admin-settings.php
@@ -43,7 +43,7 @@ class SP_Admin_Settings {
$settings = apply_filters( 'sportspress_get_settings_pages', $settings );
$settings[] = include( 'settings/class-sp-settings-text.php' );
- $settings[] = include( 'settings/class-sp-settings-config.php' );
+ //$settings[] = include( 'settings/class-sp-settings-config.php' );
self::$settings = apply_filters( 'sportspress_get_settings_config_pages', $settings );
}
diff --git a/includes/admin/class-sp-admin.php b/includes/admin/class-sp-admin.php
index 05d88b7f..0dcefe7a 100644
--- a/includes/admin/class-sp-admin.php
+++ b/includes/admin/class-sp-admin.php
@@ -34,6 +34,7 @@ class SP_Admin {
// Classes
include_once( 'class-sp-admin-post-types.php' );
include_once( 'class-sp-admin-taxonomies.php' );
+ include_once( 'class-sp-admin-ajax.php' );
// Classes we only need if the ajax is not-ajax
if ( ! is_ajax() ) {
diff --git a/includes/admin/settings/class-sp-settings-config.php b/includes/admin/settings/class-sp-settings-config.php
deleted file mode 100644
index e91aa67d..00000000
--- a/includes/admin/settings/class-sp-settings-config.php
+++ /dev/null
@@ -1,431 +0,0 @@
-id = 'config';
- $this->label = __( 'Configure', 'sportspress' );
-
- 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_results', array( $this, 'results_setting' ) );
- add_action( 'sportspress_admin_field_outcomes', array( $this, 'outcomes_setting' ) );
- add_action( 'sportspress_admin_field_columns', array( $this, 'columns_setting' ) );
- add_action( 'sportspress_admin_field_metrics', array( $this, 'metrics_setting' ) );
- add_action( 'sportspress_admin_field_performance', array( $this, 'performance_setting' ) );
- add_action( 'sportspress_admin_field_statistics', array( $this, 'statistics_setting' ) );
- add_action( 'sportspress_settings_save_' . $this->id, array( $this, 'save' ) );
- }
-
- /**
- * Get settings array
- *
- * @return array
- */
- public function get_settings() {
-
- $settings = array(
- array( 'title' => __( 'Configure SportsPress', 'sportspress' ), 'type' => 'title','desc' => '', 'id' => 'config_options' ),
-
- array( 'type' => 'outcomes' ),
-
- array( 'type' => 'results' ),
- );
-
- if ( SP()->mode == 'team' ) $settings[] = array( 'type' => 'performance' );
-
- $settings[] = array( 'type' => 'columns' );
-
- if ( SP()->mode == 'team' ):
- $settings = array_merge( $settings, array(
- array( 'type' => 'metrics' ),
-
- array( 'type' => 'statistics' ),
- ));
- endif;
-
- $settings[] = array( 'type' => 'sectionend', 'id' => 'config_options' ); // End event settings
-
- return apply_filters( 'sportspress_config_settings', $settings );
- }
-
- /**
- * Save settings
- */
- public function save() {
- if ( isset( $_POST['sportspress_primary_result'] ) ):
- update_option( 'sportspress_primary_result', $_POST['sportspress_primary_result'] );
- endif;
-
- $settings = $this->get_settings();
- SP_Admin_Settings::save_fields( $settings );
- }
-
- /**
- * Output outcomes settings
- *
- * @access public
- * @return void
- */
- public function outcomes_setting() {
- $args = array(
- 'post_type' => 'sp_outcome',
- 'numberposts' => -1,
- 'posts_per_page' => -1,
- 'orderby' => 'menu_order',
- 'order' => 'ASC'
- );
- $data = get_posts( $args );
- ?>
-
- |
-
-
- |
-
-
-
-
- |
- |
- |
- |
- |
-
-
-
- >
- | post_title; ?> |
- post_name; ?> |
- ID ); ?> |
- post_excerpt; ?> |
- |
-
-
-
-
- |
-
- 'sp_result',
- 'numberposts' => -1,
- 'posts_per_page' => -1,
- 'orderby' => 'menu_order',
- 'order' => 'ASC'
- );
- $data = get_posts( $args );
- ?>
-
- |
-
-
- |
-
-
-
-
- |
-
- 'sp_performance',
- 'numberposts' => -1,
- 'posts_per_page' => -1,
- 'orderby' => 'menu_order',
- 'order' => 'ASC'
- );
- $data = get_posts( $args );
- ?>
-
- |
-
-
- |
-
-
-
-
- |
- |
- |
- |
-
-
-
- >
- | post_title; ?> |
- post_name; ?> |
- post_excerpt; ?> |
- |
-
-
-
-
- |
-
- 'sp_column',
- 'numberposts' => -1,
- 'posts_per_page' => -1,
- 'orderby' => 'menu_order',
- 'order' => 'ASC'
- );
- $data = get_posts( $args );
- ?>
-
- |
-
-
- |
-
-
-
-
- |
- |
- |
- |
- |
- |
- |
-
-
-
- >
- | post_title; ?> |
- post_name; ?> |
- ID ); ?> |
- ID ); ?> |
- ID ); ?> |
- post_excerpt; ?> |
- |
-
-
-
-
-
- |
-
- 'sp_metric',
- 'numberposts' => -1,
- 'posts_per_page' => -1,
- 'orderby' => 'menu_order',
- 'order' => 'ASC'
- );
- $data = get_posts( $args );
- ?>
-
- |
-
-
- |
-
-
-
-
- |
- |
- |
- |
-
-
-
- >
- | post_title; ?> |
- post_name; ?> |
- post_excerpt; ?> |
- |
-
-
-
-
- |
-
- 'sp_statistic',
- 'numberposts' => -1,
- 'posts_per_page' => -1,
- 'orderby' => 'menu_order',
- 'order' => 'ASC'
- );
- $data = get_posts( $args );
- ?>
-
- |
-
-
- |
-
-
-
-
- |
- |
- |
- |
- |
- |
-
-
-
- >
- | post_title; ?> |
- post_name; ?> |
- ID ); ?> |
- ID ); ?> |
- post_excerpt; ?> |
- |
-
-
-
-
- |
-
-
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
\ No newline at end of file