Add filters for registering taxonomies and update individual mode

This commit is contained in:
Brian Miyaji
2015-09-17 17:07:21 +10:00
parent cb2bd663e1
commit e7c010a959
3 changed files with 175 additions and 160 deletions

View File

@@ -52,10 +52,12 @@ class SP_Meta_Box_List_Data {
<?php echo 'number' == $orderby ? '#' : __( 'Rank', 'sportspress' ); ?>
</label></th>
<th><?php _e( 'Player', 'sportspress' ); ?></th>
<th><label for="sp_columns_team">
<input type="checkbox" name="sp_columns[]" value="team" id="sp_columns_team" <?php checked( ! is_array( $columns ) || array_key_exists( 'team', $columns ) ); ?>>
<?php _e( 'Team', 'sportspress' ); ?>
</label></th>
<?php if ( apply_filters( 'sportspress_has_teams', true ) ) { ?>
<th><label for="sp_columns_team">
<input type="checkbox" name="sp_columns[]" value="team" id="sp_columns_team" <?php checked( ! is_array( $columns ) || array_key_exists( 'team', $columns ) ); ?>>
<?php _e( 'Team', 'sportspress' ); ?>
</label></th>
<?php } ?>
<?php foreach ( $columns as $key => $label ): ?>
<?php if ( in_array( $key, array( 'number', 'team' ) ) ) continue; ?>
<th><label for="sp_columns_<?php echo $key; ?>">
@@ -100,21 +102,23 @@ class SP_Meta_Box_List_Data {
<a class="button button-primary sp-save"><?php _e( 'Save', 'sportspress' ); ?></a>
</span>
</td>
<td>
<?php
$selected = sp_array_value( $player_stats, 'team', get_post_meta( get_the_ID(), 'sp_team', true ) );
if ( ! $selected ) $selected = get_post_meta( $player_id, 'sp_team', true );
$include = get_post_meta( $player_id, 'sp_team' );
$args = array(
'post_type' => 'sp_team',
'name' => 'sp_players[' . $player_id . '][team]',
'include' => $include,
'selected' => $selected,
'values' => 'ID',
);
wp_dropdown_pages( $args );
?>
</td>
<?php if ( apply_filters( 'sportspress_has_teams', true ) ) { ?>
<td>
<?php
$selected = sp_array_value( $player_stats, 'team', get_post_meta( get_the_ID(), 'sp_team', true ) );
if ( ! $selected ) $selected = get_post_meta( $player_id, 'sp_team', true );
$include = get_post_meta( $player_id, 'sp_team' );
$args = array(
'post_type' => 'sp_team',
'name' => 'sp_players[' . $player_id . '][team]',
'include' => $include,
'selected' => $selected,
'values' => 'ID',
);
wp_dropdown_pages( $args );
?>
</td>
<?php } ?>
<?php foreach( $columns as $column => $label ):
if ( in_array( $column, array( 'number', 'team' ) ) ) continue;
$value = sp_array_value( $player_stats, $column, '' );
@@ -129,7 +133,7 @@ class SP_Meta_Box_List_Data {
else:
?>
<tr class="sp-row alternate">
<td colspan="<?php $colspan = sizeof( $columns ) + 3; echo $colspan; ?>">
<td colspan="<?php $colspan = sizeof( $columns ) + ( apply_filters( 'sportspress_has_teams', true ) ? 3 : 2 ); echo $colspan; ?>">
<?php printf( __( 'Select %s', 'sportspress' ), __( 'Data', 'sportspress' ) ); ?>
</td>
</tr>