Check if taxonomies exist before outputting in admin
This commit is contained in:
@@ -126,14 +126,16 @@ class SP_Admin_CPT_Player extends SP_Admin_CPT {
|
|||||||
if ( $typenow != 'sp_player' )
|
if ( $typenow != 'sp_player' )
|
||||||
return;
|
return;
|
||||||
|
|
||||||
$selected = isset( $_REQUEST['sp_position'] ) ? $_REQUEST['sp_position'] : null;
|
if ( taxonomy_exists( 'sp_position' ) ):
|
||||||
$args = array(
|
$selected = isset( $_REQUEST['sp_position'] ) ? $_REQUEST['sp_position'] : null;
|
||||||
'show_option_all' => __( 'Show all positions', 'sportspress' ),
|
$args = array(
|
||||||
'taxonomy' => 'sp_position',
|
'show_option_all' => __( 'Show all positions', 'sportspress' ),
|
||||||
'name' => 'sp_position',
|
'taxonomy' => 'sp_position',
|
||||||
'selected' => $selected
|
'name' => 'sp_position',
|
||||||
);
|
'selected' => $selected
|
||||||
sp_dropdown_taxonomies( $args );
|
);
|
||||||
|
sp_dropdown_taxonomies( $args );
|
||||||
|
endif;
|
||||||
|
|
||||||
$selected = isset( $_REQUEST['team'] ) ? $_REQUEST['team'] : null;
|
$selected = isset( $_REQUEST['team'] ) ? $_REQUEST['team'] : null;
|
||||||
$args = array(
|
$args = array(
|
||||||
@@ -145,23 +147,27 @@ class SP_Admin_CPT_Player extends SP_Admin_CPT {
|
|||||||
);
|
);
|
||||||
wp_dropdown_pages( $args );
|
wp_dropdown_pages( $args );
|
||||||
|
|
||||||
$selected = isset( $_REQUEST['sp_league'] ) ? $_REQUEST['sp_league'] : null;
|
if ( taxonomy_exists( 'sp_league' ) ):
|
||||||
$args = array(
|
$selected = isset( $_REQUEST['sp_league'] ) ? $_REQUEST['sp_league'] : null;
|
||||||
'show_option_all' => __( 'Show all competitions', 'sportspress' ),
|
$args = array(
|
||||||
'taxonomy' => 'sp_league',
|
'show_option_all' => __( 'Show all competitions', 'sportspress' ),
|
||||||
'name' => 'sp_league',
|
'taxonomy' => 'sp_league',
|
||||||
'selected' => $selected
|
'name' => 'sp_league',
|
||||||
);
|
'selected' => $selected
|
||||||
sp_dropdown_taxonomies( $args );
|
);
|
||||||
|
sp_dropdown_taxonomies( $args );
|
||||||
|
endif;
|
||||||
|
|
||||||
$selected = isset( $_REQUEST['sp_season'] ) ? $_REQUEST['sp_season'] : null;
|
if ( taxonomy_exists( 'sp_season' ) ):
|
||||||
$args = array(
|
$selected = isset( $_REQUEST['sp_season'] ) ? $_REQUEST['sp_season'] : null;
|
||||||
'show_option_all' => __( 'Show all seasons', 'sportspress' ),
|
$args = array(
|
||||||
'taxonomy' => 'sp_season',
|
'show_option_all' => __( 'Show all seasons', 'sportspress' ),
|
||||||
'name' => 'sp_season',
|
'taxonomy' => 'sp_season',
|
||||||
'selected' => $selected
|
'name' => 'sp_season',
|
||||||
);
|
'selected' => $selected
|
||||||
sp_dropdown_taxonomies( $args );
|
);
|
||||||
|
sp_dropdown_taxonomies( $args );
|
||||||
|
endif;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|||||||
Reference in New Issue
Block a user