Final Commit for importing DoB of Players
This commit is contained in:
@@ -122,6 +122,10 @@ if ( class_exists( 'WP_Importer' ) ) {
|
|||||||
}
|
}
|
||||||
else:
|
else:
|
||||||
$args = array( 'post_type' => 'sp_player', 'post_status' => 'publish', 'post_title' => wp_strip_all_tags( $name ) );
|
$args = array( 'post_type' => 'sp_player', 'post_status' => 'publish', 'post_title' => wp_strip_all_tags( $name ) );
|
||||||
|
// Check if a DoB was set
|
||||||
|
if( '0000-00-00' !== $date ){
|
||||||
|
$args['post_date'] = $date;
|
||||||
|
}
|
||||||
$id = wp_insert_post( $args );
|
$id = wp_insert_post( $args );
|
||||||
|
|
||||||
// Flag as import
|
// Flag as import
|
||||||
@@ -220,7 +224,7 @@ if ( class_exists( 'WP_Importer' ) ) {
|
|||||||
function greet() {
|
function greet() {
|
||||||
echo '<div class="narrow">';
|
echo '<div class="narrow">';
|
||||||
echo '<p>' . __( 'Hi there! Choose a .csv file to upload, then click "Upload file and import".', 'sportspress' ).'</p>';
|
echo '<p>' . __( 'Hi there! Choose a .csv file to upload, then click "Upload file and import".', 'sportspress' ).'</p>';
|
||||||
echo '<p>' . sprintf( __( 'Players need to be defined with columns in a specific order (7 columns). <a href="%s">Click here to download a sample</a>.', 'sportspress' ), plugin_dir_url( SP_PLUGIN_FILE ) . 'dummy-data/players-sample.csv' ) . '</p>';
|
echo '<p>' . sprintf( __( 'Players need to be defined with columns in a specific order (8 columns). <a href="%s">Click here to download a sample</a>.', 'sportspress' ), plugin_dir_url( SP_PLUGIN_FILE ) . 'dummy-data/players-sample.csv' ) . '</p>';
|
||||||
wp_import_upload_form( 'admin.php?import=sp_player_csv&step=1' );
|
wp_import_upload_form( 'admin.php?import=sp_player_csv&step=1' );
|
||||||
echo '</div>';
|
echo '</div>';
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user