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' ); ?> <?php echo 'number' == $orderby ? '#' : __( 'Rank', 'sportspress' ); ?>
</label></th> </label></th>
<th><?php _e( 'Player', 'sportspress' ); ?></th> <th><?php _e( 'Player', 'sportspress' ); ?></th>
<?php if ( apply_filters( 'sportspress_has_teams', true ) ) { ?>
<th><label for="sp_columns_team"> <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 ) ); ?>> <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' ); ?> <?php _e( 'Team', 'sportspress' ); ?>
</label></th> </label></th>
<?php } ?>
<?php foreach ( $columns as $key => $label ): ?> <?php foreach ( $columns as $key => $label ): ?>
<?php if ( in_array( $key, array( 'number', 'team' ) ) ) continue; ?> <?php if ( in_array( $key, array( 'number', 'team' ) ) ) continue; ?>
<th><label for="sp_columns_<?php echo $key; ?>"> <th><label for="sp_columns_<?php echo $key; ?>">
@@ -100,6 +102,7 @@ class SP_Meta_Box_List_Data {
<a class="button button-primary sp-save"><?php _e( 'Save', 'sportspress' ); ?></a> <a class="button button-primary sp-save"><?php _e( 'Save', 'sportspress' ); ?></a>
</span> </span>
</td> </td>
<?php if ( apply_filters( 'sportspress_has_teams', true ) ) { ?>
<td> <td>
<?php <?php
$selected = sp_array_value( $player_stats, 'team', get_post_meta( get_the_ID(), 'sp_team', true ) ); $selected = sp_array_value( $player_stats, 'team', get_post_meta( get_the_ID(), 'sp_team', true ) );
@@ -115,6 +118,7 @@ class SP_Meta_Box_List_Data {
wp_dropdown_pages( $args ); wp_dropdown_pages( $args );
?> ?>
</td> </td>
<?php } ?>
<?php foreach( $columns as $column => $label ): <?php foreach( $columns as $column => $label ):
if ( in_array( $column, array( 'number', 'team' ) ) ) continue; if ( in_array( $column, array( 'number', 'team' ) ) ) continue;
$value = sp_array_value( $player_stats, $column, '' ); $value = sp_array_value( $player_stats, $column, '' );
@@ -129,7 +133,7 @@ class SP_Meta_Box_List_Data {
else: else:
?> ?>
<tr class="sp-row alternate"> <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' ) ); ?> <?php printf( __( 'Select %s', 'sportspress' ), __( 'Data', 'sportspress' ) ); ?>
</td> </td>
</tr> </tr>

View File

@@ -32,6 +32,7 @@ class SP_Post_types {
public static function register_taxonomies() { public static function register_taxonomies() {
do_action( 'sportspress_register_taxonomy' ); do_action( 'sportspress_register_taxonomy' );
if ( apply_filters( 'sportspress_has_leagues', true ) ):
$labels = array( $labels = array(
'name' => __( 'Competitions', 'sportspress' ), 'name' => __( 'Competitions', 'sportspress' ),
'singular_name' => __( 'Competition', 'sportspress' ), 'singular_name' => __( 'Competition', 'sportspress' ),
@@ -60,7 +61,9 @@ class SP_Post_types {
foreach ( $object_types as $object_type ): foreach ( $object_types as $object_type ):
register_taxonomy_for_object_type( 'sp_league', $object_type ); register_taxonomy_for_object_type( 'sp_league', $object_type );
endforeach; endforeach;
endif;
if ( apply_filters( 'sportspress_has_seasons', true ) ):
$labels = array( $labels = array(
'name' => __( 'Seasons', 'sportspress' ), 'name' => __( 'Seasons', 'sportspress' ),
'singular_name' => __( 'Season', 'sportspress' ), 'singular_name' => __( 'Season', 'sportspress' ),
@@ -89,7 +92,9 @@ class SP_Post_types {
foreach ( $object_types as $object_type ): foreach ( $object_types as $object_type ):
register_taxonomy_for_object_type( 'sp_season', $object_type ); register_taxonomy_for_object_type( 'sp_season', $object_type );
endforeach; endforeach;
endif;
if ( apply_filters( 'sportspress_has_venues', true ) ):
$labels = array( $labels = array(
'name' => __( 'Venues', 'sportspress' ), 'name' => __( 'Venues', 'sportspress' ),
'singular_name' => __( 'Venue', 'sportspress' ), 'singular_name' => __( 'Venue', 'sportspress' ),
@@ -118,7 +123,9 @@ class SP_Post_types {
foreach ( $object_types as $object_type ): foreach ( $object_types as $object_type ):
register_taxonomy_for_object_type( 'sp_venue', $object_type ); register_taxonomy_for_object_type( 'sp_venue', $object_type );
endforeach; endforeach;
endif;
if ( apply_filters( 'sportspress_has_positions', true ) ):
$labels = array( $labels = array(
'name' => __( 'Positions', 'sportspress' ), 'name' => __( 'Positions', 'sportspress' ),
'singular_name' => __( 'Position', 'sportspress' ), 'singular_name' => __( 'Position', 'sportspress' ),
@@ -147,7 +154,9 @@ class SP_Post_types {
foreach ( $object_types as $object_type ): foreach ( $object_types as $object_type ):
register_taxonomy_for_object_type( 'sp_position', $object_type ); register_taxonomy_for_object_type( 'sp_position', $object_type );
endforeach; endforeach;
endif;
if ( apply_filters( 'sportspress_has_roles', true ) ):
$labels = array( $labels = array(
'name' => __( 'Jobs', 'sportspress' ), 'name' => __( 'Jobs', 'sportspress' ),
'singular_name' => __( 'Job', 'sportspress' ), 'singular_name' => __( 'Job', 'sportspress' ),
@@ -176,6 +185,7 @@ class SP_Post_types {
foreach ( $object_types as $object_type ): foreach ( $object_types as $object_type ):
register_taxonomy_for_object_type( 'sp_role', $object_type ); register_taxonomy_for_object_type( 'sp_role', $object_type );
endforeach; endforeach;
endif;
do_action( 'sportspress_after_register_taxonomy' ); do_action( 'sportspress_after_register_taxonomy' );
} }

View File

@@ -58,6 +58,7 @@ class SportsPress_Individual_Mode {
add_filter( 'sportspress_staff_teams', '__return_false' ); add_filter( 'sportspress_staff_teams', '__return_false' );
add_filter( 'sportspress_list_team_selector', '__return_false' ); add_filter( 'sportspress_list_team_selector', '__return_false' );
add_filter( 'option_sportspress_event_split_players_by_team', '__return_false' ); add_filter( 'option_sportspress_event_split_players_by_team', '__return_false' );
add_filter( 'sportspress_has_teams', '__return_false' );
// Remove templates // Remove templates
//remove_action( 'sportspress_single_event_content', 'sportspress_output_event_performance', 50 ); //remove_action( 'sportspress_single_event_content', 'sportspress_output_event_performance', 50 );