diff --git a/includes/admin/class-sp-admin-importers.php b/includes/admin/class-sp-admin-importers.php index 65739328..64cd1608 100644 --- a/includes/admin/class-sp-admin-importers.php +++ b/includes/admin/class-sp-admin-importers.php @@ -28,10 +28,10 @@ class SP_Admin_Importers { * Add menu items */ public function register_importers() { - register_importer( 'sportspress_event_csv', __( 'SportsPress Events (CSV)', 'sportspress' ), __( 'Import events from a csv file.', 'sportspress'), array( $this, 'events_importer' ) ); - register_importer( 'sportspress_team_csv', __( 'SportsPress Teams (CSV)', 'sportspress' ), __( 'Import teams from a csv file.', 'sportspress'), array( $this, 'teams_importer' ) ); - register_importer( 'sportspress_player_csv', __( 'SportsPress Players (CSV)', 'sportspress' ), __( 'Import players from a csv file.', 'sportspress'), array( $this, 'players_importer' ) ); - register_importer( 'sportspress_staff_csv', __( 'SportsPress Staff (CSV)', 'sportspress' ), __( 'Import staff from a csv file.', 'sportspress'), array( $this, 'staff_importer' ) ); + register_importer( 'sp_event_csv', __( 'SportsPress Events (CSV)', 'sportspress' ), __( 'Import events from a csv file.', 'sportspress'), array( $this, 'events_importer' ) ); + register_importer( 'sp_team_csv', __( 'SportsPress Teams (CSV)', 'sportspress' ), __( 'Import teams from a csv file.', 'sportspress'), array( $this, 'teams_importer' ) ); + register_importer( 'sp_player_csv', __( 'SportsPress Players (CSV)', 'sportspress' ), __( 'Import players from a csv file.', 'sportspress'), array( $this, 'players_importer' ) ); + register_importer( 'sp_staff_csv', __( 'SportsPress Staff (CSV)', 'sportspress' ), __( 'Import staff from a csv file.', 'sportspress'), array( $this, 'staff_importer' ) ); } /** diff --git a/includes/admin/class-sp-admin.php b/includes/admin/class-sp-admin.php index e3f770b7..0e64ca3b 100644 --- a/includes/admin/class-sp-admin.php +++ b/includes/admin/class-sp-admin.php @@ -21,6 +21,11 @@ class SP_Admin { add_action( 'init', array( $this, 'includes' ) ); add_action( 'current_screen', array( $this, 'conditonal_includes' ) ); add_action( 'admin_init', array( $this, 'prevent_admin_access' ) ); + + // Action buttons + add_action( 'admin_print_footer_scripts', array( $this, 'action_links' ) ); + + // Review link add_action( 'sportspress_settings_page', 'sp_review_link' ); add_action( 'sportspress_config_page', 'sp_review_link' ); add_action( 'sportspress_overview_page', 'sp_review_link' ); @@ -86,6 +91,25 @@ class SP_Admin { exit; } } + + /** + * Add action link after post list title + */ + public function action_links() { + global $pagenow, $typenow; + if ( 'edit.php' == $pagenow && in_array( $typenow, sp_primary_post_types() ) ) { + ?> + + import_page = 'sportspress_event_csv'; + $this->import_page = 'sp_event_csv'; $this->import_label = __( 'Import Events', 'sportspress' ); $this->columns = array( 'post_date' => __( 'Date', 'sportspress' ), @@ -449,7 +449,7 @@ if ( class_exists( 'WP_Importer' ) ) { echo '
' . __( 'Hi there! Choose a .csv file to upload, then click "Upload file and import".', 'sportspress' ).'
'; echo '' . sprintf( __( 'Events need to be defined with columns in a specific order (3+ columns). Click here to download a sample.', 'sportspress' ), plugin_dir_url( SP_PLUGIN_FILE ) . 'dummy-data/events-sample.csv' ) . '
'; - wp_import_upload_form( 'admin.php?import=sportspress_event_csv&step=1' ); + wp_import_upload_form( 'admin.php?import=sp_event_csv&step=1' ); echo '' . __( 'Hi there! Choose a .csv file to upload, then click "Upload file and import".', 'sportspress' ).'
'; echo '' . sprintf( __( 'Players need to be defined with columns in a specific order (7 columns). Click here to download a sample.', 'sportspress' ), plugin_dir_url( SP_PLUGIN_FILE ) . 'dummy-data/players-sample.csv' ) . '
'; - wp_import_upload_form( 'admin.php?import=sportspress_player_csv&step=1' ); + wp_import_upload_form( 'admin.php?import=sp_player_csv&step=1' ); echo '' . __( 'Hi there! Choose a .csv file to upload, then click "Upload file and import".', 'sportspress' ).'
'; echo '' . sprintf( __( 'Staff need to be defined with columns in a specific order (6 columns). Click here to download a sample.', 'sportspress' ), plugin_dir_url( SP_PLUGIN_FILE ) . 'dummy-data/staff-sample.csv' ) . '
'; - wp_import_upload_form( 'admin.php?import=sportspress_staff_csv&step=1' ); + wp_import_upload_form( 'admin.php?import=sp_staff_csv&step=1' ); echo '' . __( 'Hi there! Choose a .csv file to upload, then click "Upload file and import".', 'sportspress' ).'
'; echo '' . sprintf( __( 'Teams need to be defined with columns in a specific order (3 columns). Click here to download a sample.', 'sportspress' ), plugin_dir_url( SP_PLUGIN_FILE ) . 'dummy-data/teams-sample.csv' ) . '
'; - wp_import_upload_form( 'admin.php?import=sportspress_team_csv&step=1' ); + wp_import_upload_form( 'admin.php?import=sp_team_csv&step=1' ); echo '