Add calendar post type

This commit is contained in:
Brian Miyaji
2014-03-17 02:14:37 +11:00
parent dd8d9c902b
commit 7de9d811e3
8 changed files with 261 additions and 8 deletions

View File

@@ -5,6 +5,7 @@ function sportspress_save_post( $post_id ) {
if ( !current_user_can( 'edit_post', $post_id ) ) return $post_id;
if ( !isset( $_POST['sportspress_nonce'] ) || ! wp_verify_nonce( $_POST['sportspress_nonce'], SPORTSPRESS_PLUGIN_BASENAME ) ) return $post_id;
switch ( $_POST['post_type'] ):
case ( 'sp_team' ):
// Update leagues seasons to show
@@ -50,6 +51,25 @@ function sportspress_save_post( $post_id ) {
break;
case ( 'sp_calendar' ):
// Update format
update_post_meta( $post_id, 'sp_format', sportspress_array_value( $_POST, 'sp_format', 'calendar' ) );
// Update league taxonomy
wp_set_post_terms( $post_id, sportspress_array_value( $_POST, 'sp_league', 0 ), 'sp_league' );
// Update season taxonomy
wp_set_post_terms( $post_id, sportspress_array_value( $_POST, 'sp_season', 0 ), 'sp_season' );
// Update venue taxonomy
wp_set_post_terms( $post_id, sportspress_array_value( $_POST, 'sp_venue', 0 ), 'sp_venue' );
// Update team
update_post_meta( $post_id, 'sp_team', sportspress_array_value( $_POST, 'sp_team', 0 ) );
break;
case ( 'sp_result' ):
// Delete posts with duplicate key