Combine request filter dropdowns and remove unused arguments
This commit is contained in:
122
actions.php
122
actions.php
@@ -16,25 +16,28 @@ function sp_manage_posts_custom_column( $column, $post_id ) {
|
||||
the_post_thumbnail( 'sp_icon' );
|
||||
break;
|
||||
case 'sp_position':
|
||||
get_the_terms ( $post_id, 'sp_position' ) ? the_terms( $post_id, 'sp_position' ) : print '—';
|
||||
echo get_the_terms ( $post_id, 'sp_position' ) ? the_terms( $post_id, 'sp_position' ) : '—';
|
||||
break;
|
||||
case 'sp_team':
|
||||
get_post_meta ( $post_id, 'sp_team' ) ? sp_the_posts( $post_id, 'sp_team', '', '<br />' ) : print '—';
|
||||
echo get_post_meta ( $post_id, 'sp_team' ) ? sp_the_posts( $post_id, 'sp_team', '', '<br />' ) : '—';
|
||||
break;
|
||||
case 'sp_event':
|
||||
echo get_post_meta ( $post_id, 'sp_event' ) ? sizeof( get_post_meta ( $post_id, 'sp_event' ) ) : '—';
|
||||
break;
|
||||
case 'sp_league':
|
||||
get_the_terms ( $post_id, 'sp_league' ) ? the_terms( $post_id, 'sp_league' ) : print '—';
|
||||
echo get_the_terms ( $post_id, 'sp_league' ) ? the_terms( $post_id, 'sp_league' ) : '—';
|
||||
break;
|
||||
case 'sp_season':
|
||||
get_the_terms ( $post_id, 'sp_season' ) ? the_terms( $post_id, 'sp_season' ) : print '—';
|
||||
echo get_the_terms ( $post_id, 'sp_season' ) ? the_terms( $post_id, 'sp_season' ) : '—';
|
||||
break;
|
||||
case 'sp_sponsor':
|
||||
get_the_terms ( $post_id, 'sp_sponsor' ) ? the_terms( $post_id, 'sp_sponsor' ) : print '—';
|
||||
echo get_the_terms ( $post_id, 'sp_sponsor' ) ? the_terms( $post_id, 'sp_sponsor' ) : '—';
|
||||
break;
|
||||
case 'sp_kickoff':
|
||||
echo get_the_date ( get_option ( 'date_format' ) ) . '<br />' . get_the_time ( get_option ( 'time_format' ) );
|
||||
break;
|
||||
case 'sp_address':
|
||||
echo get_post_meta( $post_id, 'sp_address', true );
|
||||
echo get_post_meta( $post_id, 'sp_address', true ) ? get_post_meta( $post_id, 'sp_address', true ) : '—';
|
||||
break;
|
||||
endswitch;
|
||||
}
|
||||
@@ -43,63 +46,56 @@ add_action( 'manage_pages_custom_column', 'sp_manage_posts_custom_column', 10, 2
|
||||
|
||||
function sp_restrict_manage_posts() {
|
||||
global $typenow, $wp_query;
|
||||
switch ( $typenow ):
|
||||
case 'sp_player':
|
||||
|
||||
// Teams
|
||||
$selected = isset( $_REQUEST['sp_team'] ) ? $_REQUEST['sp_team'] : null;
|
||||
$args = array(
|
||||
'show_option_none' => sprintf( __( 'All %s', 'sportspress' ), __( 'Teams', 'sportspress' ) ),
|
||||
'post_type' => 'sp_team',
|
||||
'name' => 'sp_team',
|
||||
'selected' => $selected
|
||||
);
|
||||
wp_dropdown_pages( $args );
|
||||
|
||||
// Positions
|
||||
$selected = isset( $_REQUEST['sp_position'] ) ? $_REQUEST['sp_position'] : null;
|
||||
$args = array(
|
||||
'show_option_all' => sprintf( __( 'All %s', 'sportspress' ), __( 'Positions', 'sportspress' ) ),
|
||||
'taxonomy' => 'sp_position',
|
||||
'name' => 'sp_position',
|
||||
'selected' => $selected
|
||||
);
|
||||
sp_dropdown_taxonomies( $args );
|
||||
echo PHP_EOL;
|
||||
|
||||
// Leagues
|
||||
$selected = isset( $_REQUEST['sp_league'] ) ? $_REQUEST['sp_league'] : null;
|
||||
$args = array(
|
||||
'show_option_all' => sprintf( __( 'All %s', 'sportspress' ), __( 'Leagues', 'sportspress' ) ),
|
||||
'taxonomy' => 'sp_league',
|
||||
'name' => 'sp_league',
|
||||
'selected' => $selected
|
||||
);
|
||||
sp_dropdown_taxonomies( $args );
|
||||
echo PHP_EOL;
|
||||
|
||||
// Seasons
|
||||
$selected = isset( $_REQUEST['sp_season'] ) ? $_REQUEST['sp_season'] : null;
|
||||
$args = array(
|
||||
'show_option_all' => sprintf( __( 'All %s', 'sportspress' ), __( 'Seasons', 'sportspress' ) ),
|
||||
'taxonomy' => 'sp_season',
|
||||
'name' => 'sp_season',
|
||||
'selected' => $selected
|
||||
);
|
||||
sp_dropdown_taxonomies( $args );
|
||||
echo PHP_EOL;
|
||||
|
||||
// Sponsors
|
||||
$selected = isset( $_REQUEST['sp_sponsor'] ) ? $_REQUEST['sp_sponsor'] : null;
|
||||
$args = array(
|
||||
'show_option_all' => sprintf( __( 'All %s', 'sportspress' ), __( 'Sponsors', 'sportspress' ) ),
|
||||
'taxonomy' => 'sp_sponsor',
|
||||
'name' => 'sp_sponsor',
|
||||
'selected' => $selected
|
||||
);
|
||||
sp_dropdown_taxonomies( $args );
|
||||
|
||||
endswitch;
|
||||
if ( in_array( $typenow, array( 'sp_event', 'sp_player', 'sp_staff', 'sp_table', 'sp_calendar', 'sp_tournament' ) ) ):
|
||||
$selected = isset( $_REQUEST['sp_team'] ) ? $_REQUEST['sp_team'] : null;
|
||||
$args = array(
|
||||
'show_option_none' => sprintf( __( 'All %s', 'sportspress' ), __( 'Teams', 'sportspress' ) ),
|
||||
'post_type' => 'sp_team',
|
||||
'name' => 'sp_team',
|
||||
'selected' => $selected
|
||||
);
|
||||
wp_dropdown_pages( $args );
|
||||
endif;
|
||||
if ( in_array( $typenow, array( 'sp_player', 'sp_staff' ) ) ):
|
||||
$selected = isset( $_REQUEST['sp_position'] ) ? $_REQUEST['sp_position'] : null;
|
||||
$args = array(
|
||||
'show_option_all' => sprintf( __( 'All %s', 'sportspress' ), __( 'Positions', 'sportspress' ) ),
|
||||
'taxonomy' => 'sp_position',
|
||||
'name' => 'sp_position',
|
||||
'selected' => $selected
|
||||
);
|
||||
sp_dropdown_taxonomies( $args );
|
||||
endif;
|
||||
if ( in_array( $typenow, array( 'sp_team', 'sp_event', 'sp_player', 'sp_staff', 'sp_table', 'sp_calendar' ) ) ):
|
||||
$selected = isset( $_REQUEST['sp_league'] ) ? $_REQUEST['sp_league'] : null;
|
||||
$args = array(
|
||||
'show_option_all' => sprintf( __( 'All %s', 'sportspress' ), __( 'Leagues', 'sportspress' ) ),
|
||||
'taxonomy' => 'sp_league',
|
||||
'name' => 'sp_league',
|
||||
'selected' => $selected
|
||||
);
|
||||
sp_dropdown_taxonomies( $args );
|
||||
endif;
|
||||
if ( in_array( $typenow, array( 'sp_team', 'sp_event', 'sp_player', 'sp_staff', 'sp_table', 'sp_calendar' ) ) ):
|
||||
$selected = isset( $_REQUEST['sp_season'] ) ? $_REQUEST['sp_season'] : null;
|
||||
$args = array(
|
||||
'show_option_all' => sprintf( __( 'All %s', 'sportspress' ), __( 'Seasons', 'sportspress' ) ),
|
||||
'taxonomy' => 'sp_season',
|
||||
'name' => 'sp_season',
|
||||
'selected' => $selected
|
||||
);
|
||||
sp_dropdown_taxonomies( $args );
|
||||
endif;
|
||||
if ( in_array( $typenow, array( 'sp_team', 'sp_event', 'sp_player', 'sp_tournament', 'sp_venue' ) ) ):
|
||||
$selected = isset( $_REQUEST['sp_sponsor'] ) ? $_REQUEST['sp_sponsor'] : null;
|
||||
$args = array(
|
||||
'show_option_all' => sprintf( __( 'All %s', 'sportspress' ), __( 'Sponsors', 'sportspress' ) ),
|
||||
'taxonomy' => 'sp_sponsor',
|
||||
'name' => 'sp_sponsor',
|
||||
'selected' => $selected
|
||||
);
|
||||
sp_dropdown_taxonomies( $args );
|
||||
endif;
|
||||
}
|
||||
add_action( 'restrict_manage_posts', 'sp_restrict_manage_posts' );
|
||||
|
||||
|
||||
32
calendar.php
32
calendar.php
@@ -15,7 +15,7 @@ function sp_calendar_cpt_init() {
|
||||
}
|
||||
add_action( 'init', 'sp_calendar_cpt_init' );
|
||||
|
||||
function sp_calendar_edit_columns( $columns ) {
|
||||
function sp_calendar_edit_columns() {
|
||||
$columns = array(
|
||||
'cb' => '<input type="checkbox" />',
|
||||
'title' => __( 'Title' ),
|
||||
@@ -26,34 +26,4 @@ function sp_calendar_edit_columns( $columns ) {
|
||||
return $columns;
|
||||
}
|
||||
add_filter( 'manage_edit-sp_calendar_columns', 'sp_calendar_edit_columns' );
|
||||
|
||||
function sp_calendar_request_filter_dropdowns() {
|
||||
global $typenow, $wp_query;
|
||||
if ( $typenow == 'sp_calendar' ) {
|
||||
|
||||
// Leagues
|
||||
$selected = isset( $_REQUEST['sp_league'] ) ? $_REQUEST['sp_league'] : null;
|
||||
$args = array(
|
||||
'show_option_all' => sprintf( __( 'All %s', 'sportspress' ), __( 'Leagues', 'sportspress' ) ),
|
||||
'taxonomy' => 'sp_league',
|
||||
'name' => 'sp_league',
|
||||
'selected' => $selected
|
||||
);
|
||||
sp_dropdown_taxonomies( $args );
|
||||
echo PHP_EOL;
|
||||
|
||||
// Seasons
|
||||
$selected = isset( $_REQUEST['sp_season'] ) ? $_REQUEST['sp_season'] : null;
|
||||
$args = array(
|
||||
'show_option_all' => sprintf( __( 'All %s', 'sportspress' ), __( 'Seasons', 'sportspress' ) ),
|
||||
'taxonomy' => 'sp_season',
|
||||
'name' => 'sp_season',
|
||||
'selected' => $selected
|
||||
);
|
||||
sp_dropdown_taxonomies( $args );
|
||||
echo PHP_EOL;
|
||||
|
||||
}
|
||||
}
|
||||
add_action( 'restrict_manage_posts', 'sp_calendar_request_filter_dropdowns' );
|
||||
?>
|
||||
166
event.php
166
event.php
@@ -32,143 +32,25 @@ function sp_event_meta_init() {
|
||||
add_meta_box( 'sp_articlediv', __( 'Article', 'sportspress' ), 'sp_event_article_meta', 'sp_event', 'normal', 'high' );
|
||||
}
|
||||
|
||||
function sp_event_team_meta( $post, $metabox ) {
|
||||
global $post_id;
|
||||
function sp_event_team_meta( $post ) {
|
||||
$limit = get_option( 'sp_event_team_count' );
|
||||
for ( $i = 0; $i < $limit; $i++ ):
|
||||
$selected = array_pad( array_slice( (array)get_post_meta( $post_id, 'sp_team', false ), 0, $limit ), $limit, 0);
|
||||
$selected = array_pad( array_slice( (array)get_post_meta( $post->ID, 'sp_team', false ), 0, $limit ), $limit, 0);
|
||||
$args = array(
|
||||
'post_type' => 'sp_team',
|
||||
'name' => 'sportspress[sp_team][]',
|
||||
'selected' => $selected[ $i ]
|
||||
);
|
||||
wp_dropdown_pages( $args );
|
||||
echo '<div class="clear"></div>' . PHP_EOL;
|
||||
/*
|
||||
$players = unserialize( get_post_meta( $post_id, 'sp_players', true ) );
|
||||
?>
|
||||
<div class="categorydiv" id="sp_team_<?php echo $i; ?>">
|
||||
<ul class="tb_stats-tabs category-tabs">
|
||||
<li class="tabs"><a href="#tb_home_lineup" tabindex="3"><?php _e( 'Players', 'sportspress' ); ?></a></li>
|
||||
<li class="hide-if-no-js"><a href="#tb_home_subs" tabindex="3"><?php _e( 'Staff', 'sportspress' ); ?></a></li>
|
||||
</ul>
|
||||
<div id="tb_home_lineup" class="tabs-panel">
|
||||
<?php tb_match_player_stats_table( $players, $home_club, 'home', 'lineup' ); ?>
|
||||
</div>
|
||||
<div id="tb_home_subs" class="tabs-panel" style="display: none;">
|
||||
<?php tb_match_player_stats_table( $players, $home_club, 'home', 'subs' ); ?>
|
||||
</div>
|
||||
</div>
|
||||
<div class="categorydiv" id="tb_away_players">
|
||||
<h4><?php _ex( 'Away', 'team', 'sportspress' ); ?></h4>
|
||||
<ul class="tb_stats-tabs category-tabs">
|
||||
<li class="tabs"><a href="#tb_away_lineup" tabindex="3"><?php _e( 'Players', 'sportspress' ); ?></a></li>
|
||||
<li class="hide-if-no-js"><a href="#tb_away_subs" tabindex="3"><?php _e( 'Staff', 'sportspress' ); ?></a></li>
|
||||
</ul>
|
||||
<div id="tb_away_lineup" class="tabs-panel">
|
||||
<?php tb_match_player_stats_table( $players, $away_club, 'away', 'lineup' ); ?>
|
||||
</div>
|
||||
<div id="tb_away_subs" class="tabs-panel" style="display: none;">
|
||||
<?php tb_match_player_stats_table( $players, $away_club, 'away', 'subs' ); ?>
|
||||
</div>
|
||||
</div>
|
||||
<div class="clear"></div>
|
||||
<script type="text/javascript">
|
||||
(function($) {
|
||||
// swap teams
|
||||
$('#tb_match-fixture-meta .tb-swap-teams-button').click(function() {
|
||||
// swap club buttons
|
||||
var home_button = $('#tb_home_club_button');
|
||||
var away_button = $('#tb_away_club_button');
|
||||
var temp = $(home_button).html();
|
||||
$(home_button).html($(away_button).html());
|
||||
$(away_button).html(temp);
|
||||
// swap club inputs
|
||||
var home_input = $('#tb_home_club');
|
||||
var away_input = $('#tb_away_club');
|
||||
var temp = $(home_input).val();
|
||||
$(home_input).val($(away_input).val());
|
||||
$(away_input).val(temp);
|
||||
});
|
||||
// stats tabs
|
||||
$('.tb_stats-tabs a').click(function(){
|
||||
var t = $(this).attr('href');
|
||||
$(this).parent().addClass('tabs').siblings('li').removeClass('tabs');
|
||||
$(this).parent().parent().parent().find('.tabs-panel').hide();
|
||||
$(t).show();
|
||||
return false;
|
||||
});
|
||||
$('#tb_match-players-meta table input[type="checkbox"]').live('change', function() {
|
||||
player_id = $(this).attr('data-player');
|
||||
$(this).closest('tr').find('input[type="number"]').prop('readonly', !$(this).prop('checked'));
|
||||
$(this).closest('tr').find('select').prop('disabled', !$(this).prop('checked'));
|
||||
});
|
||||
// update auto goals
|
||||
tb_update_auto_goals = function() {
|
||||
home_goals = 0;
|
||||
away_goals = 0;
|
||||
$('#tb_match-players-meta #tb_home_players table .goals input:not([readonly])').each(function() {
|
||||
home_goals += parseInt($(this).val());
|
||||
});
|
||||
$('#tb_match-players-meta #tb_away_players table .goals input:not([readonly])').each(function() {
|
||||
away_goals += parseInt($(this).val());
|
||||
});
|
||||
manual_home_goals = $('#tb_match-details-meta #results-table input#tb_goals_manual_home').val();
|
||||
manual_away_goals = $('#tb_match-details-meta #results-table input#tb_goals_manual_away').val();
|
||||
$('#tb_match-details-meta #results-table input#tb_goals_auto_home').val(home_goals);
|
||||
$('#tb_match-details-meta #results-table input#tb_goals_auto_away').val(away_goals);
|
||||
$('#tb_match-details-meta #results-table input#tb_goals_total_home').val(parseInt(home_goals) + parseInt(manual_home_goals));
|
||||
$('#tb_match-details-meta #results-table input#tb_goals_total_away').val(parseInt(away_goals) + parseInt(manual_away_goals));
|
||||
}
|
||||
$('#tb_match-players-meta table input[type="checkbox"]').live('click', function() {
|
||||
tb_update_auto_goals();
|
||||
});
|
||||
$('#tb_match-details-meta #results-table input, #tb_match-players-meta table .goals input, #tb_match-players-meta table input[type="checkbox"]').live('change', function() {
|
||||
tb_update_auto_goals();
|
||||
});
|
||||
// refresh players list
|
||||
tb_refresh_players_lists = function(side) {
|
||||
tb_refresh_players_list(side, 'lineup');
|
||||
tb_refresh_players_list(side, 'subs');
|
||||
}
|
||||
tb_refresh_players_list = function(side, type) {
|
||||
nonce = '<?php echo wp_create_nonce('tb_players_nonce'); ?>';
|
||||
club = $('#tb_' + side + '_club').val();
|
||||
$.ajax({
|
||||
type : 'post',
|
||||
dataType : 'html',
|
||||
url : ajaxurl,
|
||||
data : {
|
||||
action: 'tb_players_table',
|
||||
nonce: nonce,
|
||||
club: club,
|
||||
side: side,
|
||||
type: type
|
||||
},
|
||||
success: function(response) {
|
||||
$('#tb_match-players-meta #tb_' + side + '_' + type).html(response);
|
||||
}
|
||||
});
|
||||
}
|
||||
$('#tb_home_club').live('change', function() {
|
||||
tb_refresh_players_lists('home');
|
||||
})
|
||||
$('#tb_away_club').live('change', function() {
|
||||
tb_refresh_players_lists('away');
|
||||
})
|
||||
})(jQuery);
|
||||
</script>
|
||||
<?php
|
||||
*/
|
||||
endfor;
|
||||
sp_nonce();
|
||||
}
|
||||
|
||||
function sp_event_article_meta( $post, $metabox ) {
|
||||
function sp_event_article_meta( $post ) {
|
||||
wp_editor( $post->post_content, 'content' );
|
||||
}
|
||||
|
||||
function sp_event_edit_columns( $columns ) {
|
||||
function sp_event_edit_columns() {
|
||||
$columns = array(
|
||||
'cb' => '<input type="checkbox" />',
|
||||
'title' => __( 'Event', 'sportspress' ),
|
||||
@@ -187,44 +69,4 @@ function sp_event_edit_sortable_columns( $columns ) {
|
||||
return $columns;
|
||||
}
|
||||
add_filter( 'manage_edit-sp_event_sortable_columns', 'sp_event_edit_sortable_columns' );
|
||||
|
||||
function sp_event_request_filter_dropdowns() {
|
||||
global $typenow, $wp_query;
|
||||
if ( $typenow == 'sp_event' ) {
|
||||
|
||||
// Leagues
|
||||
$selected = isset( $_REQUEST['sp_league'] ) ? $_REQUEST['sp_league'] : null;
|
||||
$args = array(
|
||||
'show_option_all' => sprintf( __( 'All %s', 'sportspress' ), __( 'Leagues', 'sportspress' ) ),
|
||||
'taxonomy' => 'sp_league',
|
||||
'name' => 'sp_league',
|
||||
'selected' => $selected
|
||||
);
|
||||
sp_dropdown_taxonomies( $args );
|
||||
echo PHP_EOL;
|
||||
|
||||
// Seasons
|
||||
$selected = isset( $_REQUEST['sp_season'] ) ? $_REQUEST['sp_season'] : null;
|
||||
$args = array(
|
||||
'show_option_all' => sprintf( __( 'All %s', 'sportspress' ), __( 'Seasons', 'sportspress' ) ),
|
||||
'taxonomy' => 'sp_season',
|
||||
'name' => 'sp_season',
|
||||
'selected' => $selected
|
||||
);
|
||||
sp_dropdown_taxonomies( $args );
|
||||
echo PHP_EOL;
|
||||
|
||||
// Sponsors
|
||||
$selected = isset( $_REQUEST['sp_sponsor'] ) ? $_REQUEST['sp_sponsor'] : null;
|
||||
$args = array(
|
||||
'show_option_all' => sprintf( __( 'All %s', 'sportspress' ), __( 'Sponsors', 'sportspress' ) ),
|
||||
'taxonomy' => 'sp_sponsor',
|
||||
'name' => 'sp_sponsor',
|
||||
'selected' => $selected
|
||||
);
|
||||
sp_dropdown_taxonomies( $args );
|
||||
|
||||
}
|
||||
}
|
||||
add_action( 'restrict_manage_posts', 'sp_event_request_filter_dropdowns' );
|
||||
?>
|
||||
50
staff.php
50
staff.php
@@ -24,17 +24,16 @@ function sp_staff_meta_init() {
|
||||
add_meta_box( 'sp_teamdiv', __( 'Teams', 'sportspress' ), 'sp_staff_team_meta', 'sp_staff', 'side', 'high' );
|
||||
add_meta_box( 'sp_profilediv', __( 'Profile' ), 'sp_staff_profile_meta', 'sp_staff', 'normal', 'high' );
|
||||
}
|
||||
function sp_staff_team_meta( $post, $metabox ) {
|
||||
global $post_id;
|
||||
sp_post_checklist( $post_id, 'sp_team', true );
|
||||
function sp_staff_team_meta( $post ) {
|
||||
sp_post_checklist( $post->ID, 'sp_team', true );
|
||||
sp_nonce();
|
||||
}
|
||||
|
||||
function sp_staff_profile_meta( $post, $metabox ) {
|
||||
function sp_staff_profile_meta( $post ) {
|
||||
wp_editor( $post->post_content, 'content' );
|
||||
}
|
||||
|
||||
function sp_staff_edit_columns( $columns ) {
|
||||
function sp_staff_edit_columns() {
|
||||
$columns = array(
|
||||
'cb' => '<input type="checkbox" />',
|
||||
'title' => __( 'Name', 'sportspress' ),
|
||||
@@ -46,45 +45,4 @@ function sp_staff_edit_columns( $columns ) {
|
||||
return $columns;
|
||||
}
|
||||
add_filter( 'manage_edit-sp_staff_columns', 'sp_staff_edit_columns' );
|
||||
|
||||
function sp_staff_request_filter_dropdowns() {
|
||||
global $typenow, $wp_query;
|
||||
if ( $typenow == 'sp_staff' ) {
|
||||
|
||||
// Positions
|
||||
$selected = isset( $_REQUEST['sp_position'] ) ? $_REQUEST['sp_position'] : null;
|
||||
$args = array(
|
||||
'show_option_all' => sprintf( __( 'All %s', 'sportspress' ), __( 'Positions', 'sportspress' ) ),
|
||||
'taxonomy' => 'sp_position',
|
||||
'name' => 'sp_position',
|
||||
'selected' => $selected
|
||||
);
|
||||
sp_dropdown_taxonomies( $args );
|
||||
echo PHP_EOL;
|
||||
|
||||
// Leagues
|
||||
$selected = isset( $_REQUEST['sp_league'] ) ? $_REQUEST['sp_league'] : null;
|
||||
$args = array(
|
||||
'show_option_all' => sprintf( __( 'All %s', 'sportspress' ), __( 'Leagues', 'sportspress' ) ),
|
||||
'taxonomy' => 'sp_league',
|
||||
'name' => 'sp_league',
|
||||
'selected' => $selected
|
||||
);
|
||||
sp_dropdown_taxonomies( $args );
|
||||
echo PHP_EOL;
|
||||
|
||||
// Seasons
|
||||
$selected = isset( $_REQUEST['sp_season'] ) ? $_REQUEST['sp_season'] : null;
|
||||
$args = array(
|
||||
'show_option_all' => sprintf( __( 'All %s', 'sportspress' ), __( 'Seasons', 'sportspress' ) ),
|
||||
'taxonomy' => 'sp_season',
|
||||
'name' => 'sp_season',
|
||||
'selected' => $selected
|
||||
);
|
||||
sp_dropdown_taxonomies( $args );
|
||||
echo PHP_EOL;
|
||||
|
||||
}
|
||||
}
|
||||
add_action( 'restrict_manage_posts', 'sp_staff_request_filter_dropdowns' );
|
||||
?>
|
||||
32
table.php
32
table.php
@@ -15,7 +15,7 @@ function sp_table_cpt_init() {
|
||||
}
|
||||
add_action( 'init', 'sp_table_cpt_init' );
|
||||
|
||||
function sp_table_edit_columns( $columns ) {
|
||||
function sp_table_edit_columns() {
|
||||
$columns = array(
|
||||
'cb' => '<input type="checkbox" />',
|
||||
'title' => __( 'Title' ),
|
||||
@@ -26,34 +26,4 @@ function sp_table_edit_columns( $columns ) {
|
||||
return $columns;
|
||||
}
|
||||
add_filter( 'manage_edit-sp_table_columns', 'sp_table_edit_columns' );
|
||||
|
||||
function sp_table_request_filter_dropdowns() {
|
||||
global $typenow, $wp_query;
|
||||
if ( $typenow == 'sp_table' ) {
|
||||
|
||||
// Leagues
|
||||
$selected = isset( $_REQUEST['sp_league'] ) ? $_REQUEST['sp_league'] : null;
|
||||
$args = array(
|
||||
'show_option_all' => sprintf( __( 'All %s', 'sportspress' ), __( 'Leagues', 'sportspress' ) ),
|
||||
'taxonomy' => 'sp_league',
|
||||
'name' => 'sp_league',
|
||||
'selected' => $selected
|
||||
);
|
||||
sp_dropdown_taxonomies( $args );
|
||||
echo PHP_EOL;
|
||||
|
||||
// Seasons
|
||||
$selected = isset( $_REQUEST['sp_season'] ) ? $_REQUEST['sp_season'] : null;
|
||||
$args = array(
|
||||
'show_option_all' => sprintf( __( 'All %s', 'sportspress' ), __( 'Seasons', 'sportspress' ) ),
|
||||
'taxonomy' => 'sp_season',
|
||||
'name' => 'sp_season',
|
||||
'selected' => $selected
|
||||
);
|
||||
sp_dropdown_taxonomies( $args );
|
||||
echo PHP_EOL;
|
||||
|
||||
}
|
||||
}
|
||||
add_action( 'restrict_manage_posts', 'sp_table_request_filter_dropdowns' );
|
||||
?>
|
||||
42
team.php
42
team.php
@@ -23,7 +23,7 @@ function sp_team_meta_init() {
|
||||
add_meta_box( 'postimagediv', __( 'Logo', 'sportspress' ), 'post_thumbnail_meta_box', 'sp_team', 'side', 'high' );
|
||||
}
|
||||
|
||||
function sp_team_edit_columns($columns) {
|
||||
function sp_team_edit_columns() {
|
||||
$columns = array(
|
||||
'cb' => '<input type="checkbox" />',
|
||||
'sp_icon' => ' ',
|
||||
@@ -35,44 +35,4 @@ function sp_team_edit_columns($columns) {
|
||||
return $columns;
|
||||
}
|
||||
add_filter( 'manage_edit-sp_team_columns', 'sp_team_edit_columns' );
|
||||
|
||||
function sp_team_request_filter_dropdowns() {
|
||||
global $typenow, $wp_query;
|
||||
if ( $typenow == 'sp_team' ) {
|
||||
|
||||
// Leagues
|
||||
$selected = isset( $_REQUEST['sp_league'] ) ? $_REQUEST['sp_league'] : null;
|
||||
$args = array(
|
||||
'show_option_all' => sprintf( __( 'All %s', 'sportspress' ), __( 'Leagues', 'sportspress' ) ),
|
||||
'taxonomy' => 'sp_league',
|
||||
'name' => 'sp_league',
|
||||
'selected' => $selected
|
||||
);
|
||||
sp_dropdown_taxonomies( $args );
|
||||
echo PHP_EOL;
|
||||
|
||||
// Seasons
|
||||
$selected = isset( $_REQUEST['sp_season'] ) ? $_REQUEST['sp_season'] : null;
|
||||
$args = array(
|
||||
'show_option_all' => sprintf( __( 'All %s', 'sportspress' ), __( 'Seasons', 'sportspress' ) ),
|
||||
'taxonomy' => 'sp_season',
|
||||
'name' => 'sp_season',
|
||||
'selected' => $selected
|
||||
);
|
||||
sp_dropdown_taxonomies( $args );
|
||||
echo PHP_EOL;
|
||||
|
||||
// Sponsors
|
||||
$selected = isset( $_REQUEST['sp_sponsor'] ) ? $_REQUEST['sp_sponsor'] : null;
|
||||
$args = array(
|
||||
'show_option_all' => sprintf( __( 'All %s', 'sportspress' ), __( 'Sponsors', 'sportspress' ) ),
|
||||
'taxonomy' => 'sp_sponsor',
|
||||
'name' => 'sp_sponsor',
|
||||
'selected' => $selected
|
||||
);
|
||||
sp_dropdown_taxonomies( $args );
|
||||
|
||||
}
|
||||
}
|
||||
add_action( 'restrict_manage_posts', 'sp_team_request_filter_dropdowns' );
|
||||
?>
|
||||
@@ -15,7 +15,7 @@ function sp_tournament_cpt_init() {
|
||||
}
|
||||
add_action( 'init', 'sp_tournament_cpt_init' );
|
||||
|
||||
function sp_tournament_edit_columns( $columns ) {
|
||||
function sp_tournament_edit_columns() {
|
||||
$columns = array(
|
||||
'cb' => '<input type="checkbox" />',
|
||||
'title' => __( 'Title' ),
|
||||
@@ -26,44 +26,4 @@ function sp_tournament_edit_columns( $columns ) {
|
||||
return $columns;
|
||||
}
|
||||
add_filter( 'manage_edit-sp_tournament_columns', 'sp_tournament_edit_columns' );
|
||||
|
||||
function sp_tournament_custom_columns( $column ) {
|
||||
global $post, $post_id, $typenow;
|
||||
if ( $typenow == 'sp_tournament' ):
|
||||
switch ($column):
|
||||
case 'sp_team':
|
||||
echo 'TEAMS';
|
||||
break;
|
||||
case 'sp_event':
|
||||
echo 'EVENTS';
|
||||
break;
|
||||
case 'sp_sponsor':
|
||||
if ( get_the_terms ( $post_id, 'sp_sponsor' ) )
|
||||
the_terms( $post_id, 'sp_sponsor' );
|
||||
else
|
||||
echo '—';
|
||||
break;
|
||||
endswitch;
|
||||
endif;
|
||||
}
|
||||
add_action( 'manage_pages_custom_column', 'sp_tournament_custom_columns' );
|
||||
|
||||
function sp_tournament_request_filter_dropdowns() {
|
||||
global $typenow, $wp_query;
|
||||
if ( $typenow == 'sp_tournament' ) {
|
||||
|
||||
// Sponsors
|
||||
$selected = isset( $_REQUEST['sp_sponsor'] ) ? $_REQUEST['sp_sponsor'] : null;
|
||||
$args = array(
|
||||
'show_option_all' => sprintf( __( 'All %s', 'sportspress' ), __( 'Seasons', 'sportspress' ) ),
|
||||
'taxonomy' => 'sp_sponsor',
|
||||
'name' => 'sp_sponsor',
|
||||
'selected' => $selected
|
||||
);
|
||||
sp_dropdown_taxonomies( $args );
|
||||
echo PHP_EOL;
|
||||
|
||||
}
|
||||
}
|
||||
add_action( 'restrict_manage_posts', 'sp_tournament_request_filter_dropdowns' );
|
||||
?>
|
||||
20
venue.php
20
venue.php
@@ -15,7 +15,7 @@ function sp_venue_cpt_init() {
|
||||
}
|
||||
add_action( 'init', 'sp_venue_cpt_init' );
|
||||
|
||||
function sp_venue_edit_columns( $columns ) {
|
||||
function sp_venue_edit_columns() {
|
||||
$columns = array(
|
||||
'cb' => '<input type="checkbox" />',
|
||||
'title' => __( 'Venue', 'sportspress' ),
|
||||
@@ -25,22 +25,4 @@ function sp_venue_edit_columns( $columns ) {
|
||||
return $columns;
|
||||
}
|
||||
add_filter( 'manage_edit-sp_venue_columns', 'sp_venue_edit_columns' );
|
||||
|
||||
function sp_venue_request_filter_dropdowns() {
|
||||
global $typenow, $wp_query;
|
||||
if ( $typenow == 'sp_venue' ) {
|
||||
|
||||
// Sponsors
|
||||
$selected = isset( $_REQUEST['sp_sponsor'] ) ? $_REQUEST['sp_sponsor'] : null;
|
||||
$args = array(
|
||||
'show_option_all' => sprintf( __( 'All %s', 'sportspress' ), __( 'Sponsors', 'sportspress' ) ),
|
||||
'taxonomy' => 'sp_sponsor',
|
||||
'name' => 'sp_sponsor',
|
||||
'selected' => $selected
|
||||
);
|
||||
sp_dropdown_taxonomies( $args );
|
||||
|
||||
}
|
||||
}
|
||||
add_action( 'restrict_manage_posts', 'sp_venue_request_filter_dropdowns' );
|
||||
?>
|
||||
Reference in New Issue
Block a user