Move configure tab to submenu and use ajax
This commit is contained in:
@@ -23,20 +23,19 @@ class SP_Admin_Menus {
|
||||
public function __construct() {
|
||||
add_filter( 'admin_menu', array( $this, 'menu_clean' ), 5 );
|
||||
add_action( 'admin_menu', array( $this, 'admin_menu' ), 6 );
|
||||
add_action( 'admin_menu', array( $this, 'overview_menu' ), 7 );
|
||||
add_action( 'admin_menu', array( $this, 'leagues_menu' ), 8 );
|
||||
add_action( 'admin_menu', array( $this, 'seasons_menu' ), 9 );
|
||||
add_action( 'admin_menu', array( $this, 'config_menu' ), 7 );
|
||||
add_action( 'admin_menu', array( $this, 'overview_menu' ), 8 );
|
||||
add_action( 'admin_menu', array( $this, 'leagues_menu' ), 9 );
|
||||
add_action( 'admin_menu', array( $this, 'seasons_menu' ), 10 );
|
||||
|
||||
if ( current_user_can( 'manage_options' ) )
|
||||
add_action( 'admin_menu', array( $this, 'status_menu' ), 20 );
|
||||
|
||||
if ( apply_filters( 'sportspress_show_addons_page', false ) ) // Make true to display by default
|
||||
add_action( 'admin_menu', array( $this, 'addons_menu' ), 70 );
|
||||
|
||||
add_action( 'admin_head', array( $this, 'menu_highlight' ) );
|
||||
add_action( 'parent_file', array( $this, 'parent_file' ) );
|
||||
add_filter( 'menu_order', array( $this, 'menu_order' ) );
|
||||
add_filter( 'custom_menu_order', array( $this, 'custom_menu_order' ) );
|
||||
add_filter( 'sportspress_sitemap_taxonomy_post_types', array( $this, 'sitemap_taxonomy_post_types' ), 10, 2 );
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -58,6 +57,13 @@ class SP_Admin_Menus {
|
||||
add_submenu_page( 'sportspress', __( 'Overview', 'sportspress' ), __( 'Overview', 'sportspress' ), 'manage_sportspress', 'sp-overview', array( $this, 'overview_page' ) );
|
||||
}
|
||||
|
||||
/**
|
||||
* Add menu item
|
||||
*/
|
||||
public function config_menu() {
|
||||
add_submenu_page( 'sportspress', __( 'Configure', 'sportspress' ), __( 'Configure', 'sportspress' ), 'manage_sportspress', 'sp-config', array( $this, 'config_page' ) );
|
||||
}
|
||||
|
||||
/**
|
||||
* Add menu item
|
||||
*/
|
||||
@@ -80,13 +86,6 @@ class SP_Admin_Menus {
|
||||
register_setting( 'sportspress_status_settings_fields', 'sportspress_status_options' );
|
||||
}
|
||||
|
||||
/**
|
||||
* Addons menu item
|
||||
*/
|
||||
public function addons_menu() {
|
||||
add_submenu_page( 'sportspress', __( 'SportsPress Add-ons/Extensions', 'sportspress' ), __( 'Add-ons', 'sportspress' ) , 'manage_sportspress', 'sp-addons', array( $this, 'addons_page' ) );
|
||||
}
|
||||
|
||||
/**
|
||||
* Highlights the correct top level admin menu item for post type add screens.
|
||||
*
|
||||
@@ -178,14 +177,6 @@ class SP_Admin_Menus {
|
||||
$page->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;
|
||||
|
||||
Reference in New Issue
Block a user