Files
sportspress/admin/hooks/restrict-manage-posts.php
2014-02-21 09:00:22 +11:00

48 lines
1.7 KiB
PHP

<?php
function sportspress_restrict_manage_posts() {
sportspress_highlight_admin_menu();
global $typenow, $wp_query;
if ( in_array( $typenow, array( 'sp_player' ) ) ):
$selected = isset( $_REQUEST['sp_position'] ) ? $_REQUEST['sp_position'] : null;
$args = array(
'show_option_all' => __( 'Show all positions', 'sportspress' ),
'taxonomy' => 'sp_position',
'name' => 'sp_position',
'selected' => $selected
);
sportspress_dropdown_taxonomies( $args );
endif;
if ( in_array( $typenow, array( 'sp_team', 'sp_event', 'sp_player', 'sp_staff', 'sp_table', 'sp_list' ) ) ):
$selected = isset( $_REQUEST['sp_league'] ) ? $_REQUEST['sp_league'] : null;
$args = array(
'show_option_all' => __( 'Show all leagues', 'sportspress' ),
'taxonomy' => 'sp_league',
'name' => 'sp_league',
'selected' => $selected
);
sportspress_dropdown_taxonomies( $args );
endif;
if ( in_array( $typenow, array( 'sp_team', 'sp_event', 'sp_player', 'sp_staff', 'sp_table', 'sp_list' ) ) ):
$selected = isset( $_REQUEST['sp_season'] ) ? $_REQUEST['sp_season'] : null;
$args = array(
'show_option_all' => __( 'Show all seasons', 'sportspress' ),
'taxonomy' => 'sp_season',
'name' => 'sp_season',
'selected' => $selected
);
sportspress_dropdown_taxonomies( $args );
endif;
if ( in_array( $typenow, array( 'sp_event', 'sp_table', 'sp_player', 'sp_list', 'sp_staff' ) ) ):
$selected = isset( $_REQUEST['team'] ) ? $_REQUEST['team'] : null;
$args = array(
'post_type' => 'sp_team',
'name' => 'team',
'show_option_none' => __( 'Show all teams', 'sportspress' ),
'selected' => $selected,
'values' => 'ID',
);
wp_dropdown_pages( $args );
endif;
}
add_action( 'restrict_manage_posts', 'sportspress_restrict_manage_posts' );