CSV import tool added for players
This commit is contained in:
@@ -1,4 +1,21 @@
|
||||
<?php
|
||||
function sportspress_player_importer() {
|
||||
require_once ABSPATH . 'wp-admin/includes/import.php';
|
||||
|
||||
if ( ! class_exists( 'WP_Importer' ) ) {
|
||||
$class_wp_importer = ABSPATH . 'wp-admin/includes/class-wp-importer.php';
|
||||
if ( file_exists( $class_wp_importer ) )
|
||||
require $class_wp_importer;
|
||||
}
|
||||
|
||||
// includes
|
||||
require dirname( SPORTSPRESS_PLUGIN_FILE ) . '/admin/importers/player-importer.php';
|
||||
|
||||
// Dispatch
|
||||
$importer = new SP_Player_Importer();
|
||||
$importer->dispatch();
|
||||
}
|
||||
|
||||
function sportspress_admin_init() {
|
||||
$post_types = array(
|
||||
'sp_event',
|
||||
@@ -35,5 +52,7 @@ function sportspress_admin_init() {
|
||||
$administrator->add_cap( $cap . '_' . $post_type . 's' );
|
||||
endforeach;
|
||||
endforeach;
|
||||
|
||||
register_importer( 'sportspress_player_csv', __( 'SportsPress Players (CSV)', 'sportspress' ), __( 'Import <strong>players</strong> from a csv file.', 'sportspress'), 'sportspress_player_importer' );
|
||||
}
|
||||
add_action( 'admin_init', 'sportspress_admin_init' );
|
||||
|
||||
Reference in New Issue
Block a user