Prepare for individual mode
This commit is contained in:
@@ -53,20 +53,24 @@ class SP_Meta_Box_Event_Teams {
|
||||
sp_dropdown_taxonomies( $args );
|
||||
?>
|
||||
</p>
|
||||
<p class="sp-tab-select sp-title-generator">
|
||||
<?php
|
||||
$args = array(
|
||||
'post_type' => 'sp_team',
|
||||
'name' => 'sp_team[]',
|
||||
'class' => 'sportspress-pages',
|
||||
'show_option_none' => __( '— None —', 'sportspress' ),
|
||||
'show_option_all' => __( '— Individual —', 'sportspress' ),
|
||||
'values' => 'ID',
|
||||
'selected' => $team,
|
||||
);
|
||||
sp_dropdown_pages( $args );
|
||||
?>
|
||||
</p>
|
||||
<?php if ( 'teams' == get_option( 'sportspress_mode', 'teams' ) ) { ?>
|
||||
<p class="sp-tab-select sp-title-generator">
|
||||
<?php
|
||||
$args = array(
|
||||
'post_type' => 'sp_team',
|
||||
'name' => 'sp_team[]',
|
||||
'class' => 'sportspress-pages',
|
||||
'show_option_none' => __( '— None —', 'sportspress' ),
|
||||
'show_option_all' => __( '— Individual —', 'sportspress' ),
|
||||
'values' => 'ID',
|
||||
'selected' => $team,
|
||||
);
|
||||
sp_dropdown_pages( $args );
|
||||
?>
|
||||
</p>
|
||||
<?php } else { ?>
|
||||
<input type="hidden" name="sp_team[]" value="0">
|
||||
<?php } ?>
|
||||
<ul id="sp_team-tabs" class="wp-tab-bar sp-tab-bar">
|
||||
<li class="wp-tab-active"><a href="#sp_player-all"><?php _e( 'Players', 'sportspress' ); ?></a></li>
|
||||
<li class="wp-tab"><a href="#sp_staff-all"><?php _e( 'Staff', 'sportspress' ); ?></a></li>
|
||||
@@ -84,7 +88,9 @@ class SP_Meta_Box_Event_Teams {
|
||||
* Save meta box data
|
||||
*/
|
||||
public static function save( $post_id, $post ) {
|
||||
sp_update_post_meta_recursive( $post_id, 'sp_team', sp_array_value( $_POST, 'sp_team', array() ) );
|
||||
if ( 'teams' == get_option( 'sportspress_mode', 'teams' ) ) {
|
||||
sp_update_post_meta_recursive( $post_id, 'sp_team', sp_array_value( $_POST, 'sp_team', array() ) );
|
||||
}
|
||||
sp_update_post_meta_recursive( $post_id, 'sp_player', sp_array_value( $_POST, 'sp_player', array() ) );
|
||||
sp_update_post_meta_recursive( $post_id, 'sp_staff', sp_array_value( $_POST, 'sp_staff', array() ) );
|
||||
}
|
||||
|
||||
@@ -97,36 +97,40 @@ class SP_Meta_Box_Player_Statistics {
|
||||
<td> </td>
|
||||
<?php else: ?>
|
||||
<td>
|
||||
<?php
|
||||
$value = sp_array_value( $leagues, $div_id, '-1' );
|
||||
$args = array(
|
||||
'post_type' => 'sp_team',
|
||||
'name' => 'sp_leagues[' . $league_id . '][' . $div_id . ']',
|
||||
'show_option_none' => __( '— None —', 'sportspress' ),
|
||||
'show_option_all' => __( '— Individual —', 'sportspress' ),
|
||||
'sort_order' => 'ASC',
|
||||
'sort_column' => 'menu_order',
|
||||
'selected' => $value,
|
||||
'values' => 'ID',
|
||||
'include' => $teams,
|
||||
'tax_query' => array(
|
||||
'relation' => 'AND',
|
||||
array(
|
||||
'taxonomy' => 'sp_league',
|
||||
'terms' => $league_id,
|
||||
'field' => 'id',
|
||||
<?php $value = sp_array_value( $leagues, $div_id, '-1' ); ?>
|
||||
<?php if ( 'teams' == get_option( 'sportspress_mode', 'teams' ) ) { ?>
|
||||
<?php
|
||||
$args = array(
|
||||
'post_type' => 'sp_team',
|
||||
'name' => 'sp_leagues[' . $league_id . '][' . $div_id . ']',
|
||||
'show_option_none' => __( '— None —', 'sportspress' ),
|
||||
'show_option_all' => __( '— Individual —', 'sportspress' ),
|
||||
'sort_order' => 'ASC',
|
||||
'sort_column' => 'menu_order',
|
||||
'selected' => $value,
|
||||
'values' => 'ID',
|
||||
'include' => $teams,
|
||||
'tax_query' => array(
|
||||
'relation' => 'AND',
|
||||
array(
|
||||
'taxonomy' => 'sp_league',
|
||||
'terms' => $league_id,
|
||||
'field' => 'id',
|
||||
),
|
||||
array(
|
||||
'taxonomy' => 'sp_season',
|
||||
'terms' => $div_id,
|
||||
'field' => 'id',
|
||||
),
|
||||
),
|
||||
array(
|
||||
'taxonomy' => 'sp_season',
|
||||
'terms' => $div_id,
|
||||
'field' => 'id',
|
||||
),
|
||||
),
|
||||
);
|
||||
if ( ! sp_dropdown_pages( $args ) ):
|
||||
_e( '— None —', 'sportspress' );
|
||||
endif;
|
||||
?>
|
||||
);
|
||||
if ( ! sp_dropdown_pages( $args ) ):
|
||||
_e( '— None —', 'sportspress' );
|
||||
endif;
|
||||
?>
|
||||
<?php } else { ?>
|
||||
<input type="checkbox" name="sp_leagues[<?php echo $league_id; ?>][<?php echo $div_id; ?>]" value="0" <?php checked( 0, $value ); ?>>
|
||||
<?php } ?>
|
||||
</td>
|
||||
<?php endif; ?>
|
||||
<?php endif; ?>
|
||||
|
||||
@@ -46,26 +46,30 @@ $common[ __( 'Position', 'sportspress' ) ] = implode( ', ', $position_names );
|
||||
|
||||
$data = array_merge( $metrics_before, $common, $metrics_after );
|
||||
|
||||
if ( $current_teams ):
|
||||
$teams = array();
|
||||
foreach ( $current_teams as $team ):
|
||||
$team_name = get_the_title( $team );
|
||||
if ( $link_teams ) $team_name = '<a href="' . get_post_permalink( $team ) . '">' . $team_name . '</a>';
|
||||
$teams[] = $team_name;
|
||||
endforeach;
|
||||
$label = _n( 'Current Team', 'Current Teams', count( $teams ), 'sportspress' );
|
||||
$data[ $label ] = implode( ', ', $teams );
|
||||
endif;
|
||||
if ( 'teams' == get_option( 'sportspress_mode', 'teams' ) ) {
|
||||
if ( $current_teams ):
|
||||
$teams = array();
|
||||
foreach ( $current_teams as $team ):
|
||||
$team_name = get_the_title( $team );
|
||||
if ( $link_teams ) $team_name = '<a href="' . get_post_permalink( $team ) . '">' . $team_name . '</a>';
|
||||
$teams[] = $team_name;
|
||||
endforeach;
|
||||
$label = _n( 'Current Team', 'Current Teams', count( $teams ), 'sportspress' );
|
||||
$data[ $label ] = implode( ', ', $teams );
|
||||
endif;
|
||||
|
||||
if ( $past_teams ):
|
||||
$teams = array();
|
||||
foreach ( $past_teams as $team ):
|
||||
$team_name = get_the_title( $team );
|
||||
if ( $link_teams ) $team_name = '<a href="' . get_post_permalink( $team ) . '">' . $team_name . '</a>';
|
||||
$teams[] = $team_name;
|
||||
endforeach;
|
||||
$data[ __( 'Past Teams', 'sportspress' ) ] = implode( ', ', $teams );
|
||||
endif;
|
||||
if ( $past_teams ):
|
||||
$teams = array();
|
||||
foreach ( $past_teams as $team ):
|
||||
$team_name = get_the_title( $team );
|
||||
if ( $link_teams ) $team_name = '<a href="' . get_post_permalink( $team ) . '">' . $team_name . '</a>';
|
||||
$teams[] = $team_name;
|
||||
endforeach;
|
||||
$data[ __( 'Past Teams', 'sportspress' ) ] = implode( ', ', $teams );
|
||||
endif;
|
||||
}
|
||||
|
||||
$data = apply_filters( 'sportspress_player_details', $data, $id );
|
||||
|
||||
$output = '<div class="sp-template sp-template-player-details sp-template-details"><div class="sp-list-wrapper"><dl class="sp-player-details">';
|
||||
|
||||
|
||||
Reference in New Issue
Block a user