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