diff --git a/includes/admin/post-types/meta-boxes/class-sp-meta-box-player-details.php b/includes/admin/post-types/meta-boxes/class-sp-meta-box-player-details.php index c313afb9..361a4bf5 100644 --- a/includes/admin/post-types/meta-boxes/class-sp-meta-box-player-details.php +++ b/includes/admin/post-types/meta-boxes/class-sp-meta-box-player-details.php @@ -33,28 +33,34 @@ class SP_Meta_Box_Player_Details { endif; endforeach; - $leagues = get_the_terms( $post->ID, 'sp_league' ); - $league_ids = array(); - if ( $leagues ): - foreach ( $leagues as $league ): - $league_ids[] = $league->term_id; - endforeach; + if ( taxonomy_exists( 'sp_league' ) ): + $leagues = get_the_terms( $post->ID, 'sp_league' ); + $league_ids = array(); + if ( $leagues ): + foreach ( $leagues as $league ): + $league_ids[] = $league->term_id; + endforeach; + endif; endif; - $seasons = get_the_terms( $post->ID, 'sp_season' ); - $season_ids = array(); - if ( $seasons ): - foreach ( $seasons as $season ): - $season_ids[] = $season->term_id; - endforeach; + if ( taxonomy_exists( 'sp_season' ) ): + $seasons = get_the_terms( $post->ID, 'sp_season' ); + $season_ids = array(); + if ( $seasons ): + foreach ( $seasons as $season ): + $season_ids[] = $season->term_id; + endforeach; + endif; endif; - $positions = get_the_terms( $post->ID, 'sp_position' ); - $position_ids = array(); - if ( $positions ): - foreach ( $positions as $position ): - $position_ids[] = $position->term_id; - endforeach; + if ( taxonomy_exists( 'sp_position' ) ): + $positions = get_the_terms( $post->ID, 'sp_position' ); + $position_ids = array(); + if ( $positions ): + foreach ( $positions as $position ): + $position_ids[] = $position->term_id; + endforeach; + endif; endif; $teams = get_posts( array( 'post_type' => 'sp_team', 'posts_per_page' => -1 ) ); @@ -76,20 +82,22 @@ class SP_Meta_Box_Player_Details {

-

-

'sp_position', - 'name' => 'tax_input[sp_position][]', - 'selected' => $position_ids, - 'values' => 'term_id', - 'placeholder' => sprintf( __( 'Select %s', 'sportspress' ), __( 'Positions', 'sportspress' ) ), - 'class' => 'widefat', - 'property' => 'multiple', - 'chosen' => true, - ); - sp_dropdown_taxonomies( $args ); - ?>

+ +

+

'sp_position', + 'name' => 'tax_input[sp_position][]', + 'selected' => $position_ids, + 'values' => 'term_id', + 'placeholder' => sprintf( __( 'Select %s', 'sportspress' ), __( 'Positions', 'sportspress' ) ), + 'class' => 'widefat', + 'property' => 'multiple', + 'chosen' => true, + ); + sp_dropdown_taxonomies( $args ); + ?>

+

@@ -123,6 +131,7 @@ class SP_Meta_Box_Player_Details { ?>

+

+ +

+ ID, 'sp_league' ); - $league_ids = array(); - if ( $leagues ): - foreach ( $leagues as $league ): - $league_ids[] = $league->term_id; - endforeach; + + if ( taxonomy_exists( 'sp_league' ) ): + $leagues = get_the_terms( $post->ID, 'sp_league' ); + $league_ids = array(); + if ( $leagues ): + foreach ( $leagues as $league ): + $league_ids[] = $league->term_id; + endforeach; + endif; endif; - $seasons = get_the_terms( $post->ID, 'sp_season' ); - $season_ids = array(); - if ( $seasons ): - foreach ( $seasons as $season ): - $season_ids[] = $season->term_id; - endforeach; + if ( taxonomy_exists( 'sp_season' ) ): + $seasons = get_the_terms( $post->ID, 'sp_season' ); + $season_ids = array(); + if ( $seasons ): + foreach ( $seasons as $season ): + $season_ids[] = $season->term_id; + endforeach; + endif; endif; - $venues = get_the_terms( $post->ID, 'sp_venue' ); - $venue_ids = array(); - if ( $venues ): - foreach ( $venues as $venue ): - $venue_ids[] = $venue->term_id; - endforeach; + if ( taxonomy_exists( 'sp_venue' ) ): + $venues = get_the_terms( $post->ID, 'sp_venue' ); + $venue_ids = array(); + if ( $venues ): + foreach ( $venues as $venue ): + $venue_ids[] = $venue->term_id; + endforeach; + endif; endif; $abbreviation = get_post_meta( $post->ID, 'sp_abbreviation', true ); $url = get_post_meta( $post->ID, 'sp_url', true ); ?> + +

+ +

+ +

+