All leagues and seasons option to player list

This commit is contained in:
Brian Miyaji
2014-08-23 23:26:08 +10:00
parent f3d81e0cc7
commit bb41cc6cd9
2 changed files with 20 additions and 12 deletions

View File

@@ -28,11 +28,12 @@ class SP_Meta_Box_List_Details {
?>
<div>
<p><strong><?php _e( 'League', 'sportspress' ); ?></strong></p>
<p>
<p class="sp-tab-select">
<?php
$args = array(
'taxonomy' => 'sp_league',
'name' => 'sp_league',
'show_option_all' => __( 'All', 'sportspress' ),
'selected' => $league_id,
'values' => 'term_id',
);
@@ -47,6 +48,7 @@ class SP_Meta_Box_List_Details {
$args = array(
'taxonomy' => 'sp_season',
'name' => 'sp_season',
'show_option_all' => __( 'All', 'sportspress' ),
'selected' => $season_id,
'values' => 'term_id',
);
@@ -102,7 +104,7 @@ class SP_Meta_Box_List_Details {
</p>
<p><strong><?php _e( 'Players', 'sportspress' ); ?></strong></p>
<?php
sp_post_checklist( $post->ID, 'sp_player', 'block', 'sp_current_team' );
sp_post_checklist( $post->ID, 'sp_player', 'block', array( 'sp_league', 'sp_season', 'sp_current_team' ) );
sp_post_adder( 'sp_player', __( 'Add New', 'sportspress' ) );
?>
</div>

View File

@@ -718,21 +718,27 @@ if ( !function_exists( 'sp_post_checklist' ) ) {
if ( is_array( $filters ) ):
$filter_values = array();
foreach ( $filters as $filter ):
$filter_values = array_merge( $filter_values, (array)get_post_meta( $post->ID, $filter, false ) );
if ( get_taxonomy( $filter ) ):
$terms = (array)get_the_terms( $post->ID, $filter );
foreach ( $terms as $term ):
if ( is_object( $term ) && property_exists( $term, 'term_id' ) )
$filter_values[] = $term->term_id;
endforeach;
else:
$filter_values = array_merge( $filter_values, (array)get_post_meta( $post->ID, $filter, false ) );
endif;
endforeach;
else:
$filter = $filters;
if ( get_taxonomy( $filter ) ):
$terms = (array)get_the_terms( $post->ID, $filter );
foreach ( $terms as $term ):
if ( is_object( $term ) && property_exists( $term, 'term_id' ) )
$filter_values[] = $term->term_id;
endforeach;
endforeach;
else:
$filter = $filters;
$filter_values = (array)get_post_meta( $post->ID, $filter, false );
$terms = (array)get_the_terms( $post->ID, $filter );
foreach ( $terms as $term ):
if ( is_object( $term ) && property_exists( $term, 'term_id' ) )
$filter_values[] = $term->term_id;
endforeach;
else:
$filter_values = (array)get_post_meta( $post->ID, $filter, false );
endif;
endif;
endif;
?>