Check if taxonomies exist in player and team edit screen
This commit is contained in:
@@ -33,6 +33,7 @@ class SP_Meta_Box_Player_Details {
|
|||||||
endif;
|
endif;
|
||||||
endforeach;
|
endforeach;
|
||||||
|
|
||||||
|
if ( taxonomy_exists( 'sp_league' ) ):
|
||||||
$leagues = get_the_terms( $post->ID, 'sp_league' );
|
$leagues = get_the_terms( $post->ID, 'sp_league' );
|
||||||
$league_ids = array();
|
$league_ids = array();
|
||||||
if ( $leagues ):
|
if ( $leagues ):
|
||||||
@@ -40,7 +41,9 @@ class SP_Meta_Box_Player_Details {
|
|||||||
$league_ids[] = $league->term_id;
|
$league_ids[] = $league->term_id;
|
||||||
endforeach;
|
endforeach;
|
||||||
endif;
|
endif;
|
||||||
|
endif;
|
||||||
|
|
||||||
|
if ( taxonomy_exists( 'sp_season' ) ):
|
||||||
$seasons = get_the_terms( $post->ID, 'sp_season' );
|
$seasons = get_the_terms( $post->ID, 'sp_season' );
|
||||||
$season_ids = array();
|
$season_ids = array();
|
||||||
if ( $seasons ):
|
if ( $seasons ):
|
||||||
@@ -48,7 +51,9 @@ class SP_Meta_Box_Player_Details {
|
|||||||
$season_ids[] = $season->term_id;
|
$season_ids[] = $season->term_id;
|
||||||
endforeach;
|
endforeach;
|
||||||
endif;
|
endif;
|
||||||
|
endif;
|
||||||
|
|
||||||
|
if ( taxonomy_exists( 'sp_position' ) ):
|
||||||
$positions = get_the_terms( $post->ID, 'sp_position' );
|
$positions = get_the_terms( $post->ID, 'sp_position' );
|
||||||
$position_ids = array();
|
$position_ids = array();
|
||||||
if ( $positions ):
|
if ( $positions ):
|
||||||
@@ -56,6 +61,7 @@ class SP_Meta_Box_Player_Details {
|
|||||||
$position_ids[] = $position->term_id;
|
$position_ids[] = $position->term_id;
|
||||||
endforeach;
|
endforeach;
|
||||||
endif;
|
endif;
|
||||||
|
endif;
|
||||||
|
|
||||||
$teams = get_posts( array( 'post_type' => 'sp_team', 'posts_per_page' => -1 ) );
|
$teams = get_posts( array( 'post_type' => 'sp_team', 'posts_per_page' => -1 ) );
|
||||||
$past_teams = array_filter( get_post_meta( $post->ID, 'sp_past_team', false ) );
|
$past_teams = array_filter( get_post_meta( $post->ID, 'sp_past_team', false ) );
|
||||||
@@ -76,6 +82,7 @@ class SP_Meta_Box_Player_Details {
|
|||||||
<?php endforeach; ?>
|
<?php endforeach; ?>
|
||||||
</select></p>
|
</select></p>
|
||||||
|
|
||||||
|
<?php if ( taxonomy_exists( 'sp_position' ) ) { ?>
|
||||||
<p><strong><?php _e( 'Positions', 'sportspress' ); ?></strong></p>
|
<p><strong><?php _e( 'Positions', 'sportspress' ); ?></strong></p>
|
||||||
<p><?php
|
<p><?php
|
||||||
$args = array(
|
$args = array(
|
||||||
@@ -90,6 +97,7 @@ class SP_Meta_Box_Player_Details {
|
|||||||
);
|
);
|
||||||
sp_dropdown_taxonomies( $args );
|
sp_dropdown_taxonomies( $args );
|
||||||
?></p>
|
?></p>
|
||||||
|
<?php } ?>
|
||||||
|
|
||||||
<?php if ( apply_filters( 'sportspress_player_teams', true ) ) { ?>
|
<?php if ( apply_filters( 'sportspress_player_teams', true ) ) { ?>
|
||||||
<p><strong><?php _e( 'Current Teams', 'sportspress' ); ?></strong></p>
|
<p><strong><?php _e( 'Current Teams', 'sportspress' ); ?></strong></p>
|
||||||
@@ -123,6 +131,7 @@ class SP_Meta_Box_Player_Details {
|
|||||||
?></p>
|
?></p>
|
||||||
<?php } ?>
|
<?php } ?>
|
||||||
|
|
||||||
|
<?php if ( taxonomy_exists( 'sp_league' ) ) { ?>
|
||||||
<p><strong><?php _e( 'Competitions', 'sportspress' ); ?></strong></p>
|
<p><strong><?php _e( 'Competitions', 'sportspress' ); ?></strong></p>
|
||||||
<p><?php
|
<p><?php
|
||||||
$args = array(
|
$args = array(
|
||||||
@@ -137,7 +146,9 @@ class SP_Meta_Box_Player_Details {
|
|||||||
);
|
);
|
||||||
sp_dropdown_taxonomies( $args );
|
sp_dropdown_taxonomies( $args );
|
||||||
?></p>
|
?></p>
|
||||||
|
<?php } ?>
|
||||||
|
|
||||||
|
<?php if ( taxonomy_exists( 'sp_season' ) ) { ?>
|
||||||
<p><strong><?php _e( 'Seasons', 'sportspress' ); ?></strong></p>
|
<p><strong><?php _e( 'Seasons', 'sportspress' ); ?></strong></p>
|
||||||
<p><?php
|
<p><?php
|
||||||
$args = array(
|
$args = array(
|
||||||
@@ -152,6 +163,7 @@ class SP_Meta_Box_Player_Details {
|
|||||||
);
|
);
|
||||||
sp_dropdown_taxonomies( $args );
|
sp_dropdown_taxonomies( $args );
|
||||||
?></p>
|
?></p>
|
||||||
|
<?php } ?>
|
||||||
<?php
|
<?php
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -20,6 +20,8 @@ class SP_Meta_Box_Team_Details {
|
|||||||
*/
|
*/
|
||||||
public static function output( $post ) {
|
public static function output( $post ) {
|
||||||
wp_nonce_field( 'sportspress_save_data', 'sportspress_meta_nonce' );
|
wp_nonce_field( 'sportspress_save_data', 'sportspress_meta_nonce' );
|
||||||
|
|
||||||
|
if ( taxonomy_exists( 'sp_league' ) ):
|
||||||
$leagues = get_the_terms( $post->ID, 'sp_league' );
|
$leagues = get_the_terms( $post->ID, 'sp_league' );
|
||||||
$league_ids = array();
|
$league_ids = array();
|
||||||
if ( $leagues ):
|
if ( $leagues ):
|
||||||
@@ -27,7 +29,9 @@ class SP_Meta_Box_Team_Details {
|
|||||||
$league_ids[] = $league->term_id;
|
$league_ids[] = $league->term_id;
|
||||||
endforeach;
|
endforeach;
|
||||||
endif;
|
endif;
|
||||||
|
endif;
|
||||||
|
|
||||||
|
if ( taxonomy_exists( 'sp_season' ) ):
|
||||||
$seasons = get_the_terms( $post->ID, 'sp_season' );
|
$seasons = get_the_terms( $post->ID, 'sp_season' );
|
||||||
$season_ids = array();
|
$season_ids = array();
|
||||||
if ( $seasons ):
|
if ( $seasons ):
|
||||||
@@ -35,7 +39,9 @@ class SP_Meta_Box_Team_Details {
|
|||||||
$season_ids[] = $season->term_id;
|
$season_ids[] = $season->term_id;
|
||||||
endforeach;
|
endforeach;
|
||||||
endif;
|
endif;
|
||||||
|
endif;
|
||||||
|
|
||||||
|
if ( taxonomy_exists( 'sp_venue' ) ):
|
||||||
$venues = get_the_terms( $post->ID, 'sp_venue' );
|
$venues = get_the_terms( $post->ID, 'sp_venue' );
|
||||||
$venue_ids = array();
|
$venue_ids = array();
|
||||||
if ( $venues ):
|
if ( $venues ):
|
||||||
@@ -43,10 +49,13 @@ class SP_Meta_Box_Team_Details {
|
|||||||
$venue_ids[] = $venue->term_id;
|
$venue_ids[] = $venue->term_id;
|
||||||
endforeach;
|
endforeach;
|
||||||
endif;
|
endif;
|
||||||
|
endif;
|
||||||
|
|
||||||
$abbreviation = get_post_meta( $post->ID, 'sp_abbreviation', true );
|
$abbreviation = get_post_meta( $post->ID, 'sp_abbreviation', true );
|
||||||
$url = get_post_meta( $post->ID, 'sp_url', true );
|
$url = get_post_meta( $post->ID, 'sp_url', true );
|
||||||
?>
|
?>
|
||||||
|
|
||||||
|
<?php if ( taxonomy_exists( 'sp_league' ) ) { ?>
|
||||||
<p><strong><?php _e( 'Competitions', 'sportspress' ); ?></strong></p>
|
<p><strong><?php _e( 'Competitions', 'sportspress' ); ?></strong></p>
|
||||||
<p><?php
|
<p><?php
|
||||||
$args = array(
|
$args = array(
|
||||||
@@ -61,7 +70,9 @@ class SP_Meta_Box_Team_Details {
|
|||||||
);
|
);
|
||||||
sp_dropdown_taxonomies( $args );
|
sp_dropdown_taxonomies( $args );
|
||||||
?></p>
|
?></p>
|
||||||
|
<?php } ?>
|
||||||
|
|
||||||
|
<?php if ( taxonomy_exists( 'sp_season' ) ) { ?>
|
||||||
<p><strong><?php _e( 'Seasons', 'sportspress' ); ?></strong></p>
|
<p><strong><?php _e( 'Seasons', 'sportspress' ); ?></strong></p>
|
||||||
<p><?php
|
<p><?php
|
||||||
$args = array(
|
$args = array(
|
||||||
@@ -76,7 +87,9 @@ class SP_Meta_Box_Team_Details {
|
|||||||
);
|
);
|
||||||
sp_dropdown_taxonomies( $args );
|
sp_dropdown_taxonomies( $args );
|
||||||
?></p>
|
?></p>
|
||||||
|
<?php } ?>
|
||||||
|
|
||||||
|
<?php if ( taxonomy_exists( 'sp_venue' ) ) { ?>
|
||||||
<p><strong><?php _e( 'Home', 'sportspress' ); ?></strong></p>
|
<p><strong><?php _e( 'Home', 'sportspress' ); ?></strong></p>
|
||||||
<p><?php
|
<p><?php
|
||||||
$args = array(
|
$args = array(
|
||||||
@@ -91,6 +104,7 @@ class SP_Meta_Box_Team_Details {
|
|||||||
);
|
);
|
||||||
sp_dropdown_taxonomies( $args );
|
sp_dropdown_taxonomies( $args );
|
||||||
?></p>
|
?></p>
|
||||||
|
<?php } ?>
|
||||||
|
|
||||||
<p><strong><?php _e( 'Site URL', 'sportspress' ); ?></strong></p>
|
<p><strong><?php _e( 'Site URL', 'sportspress' ); ?></strong></p>
|
||||||
<p><input type="text" class="widefat" id="sp_url" name="sp_url" value="<?php echo $url; ?>"></p>
|
<p><input type="text" class="widefat" id="sp_url" name="sp_url" value="<?php echo $url; ?>"></p>
|
||||||
|
|||||||
Reference in New Issue
Block a user