Display unselected terms as All

This commit is contained in:
Brian Miyaji
2014-10-16 13:50:02 +11:00
parent 8ec57b490f
commit 803fd23694
2 changed files with 7 additions and 7 deletions

View File

@@ -63,19 +63,19 @@ class SP_Admin_CPT_Calendar extends SP_Admin_CPT {
public function custom_columns( $column, $post_id ) {
switch ( $column ):
case 'sp_league':
echo get_the_terms ( $post_id, 'sp_league' ) ? the_terms( $post_id, 'sp_league' ) : '—';
echo get_the_terms ( $post_id, 'sp_league' ) ? the_terms( $post_id, 'sp_league' ) : __( 'All', 'sportspress' );
break;
case 'sp_season':
echo get_the_terms ( $post_id, 'sp_season' ) ? the_terms( $post_id, 'sp_season' ) : '—';
echo get_the_terms ( $post_id, 'sp_season' ) ? the_terms( $post_id, 'sp_season' ) : __( 'All', 'sportspress' );
break;
case 'sp_venue':
echo get_the_terms ( $post_id, 'sp_venue' ) ? the_terms( $post_id, 'sp_venue' ) : '—';
echo get_the_terms ( $post_id, 'sp_venue' ) ? the_terms( $post_id, 'sp_venue' ) : __( 'All', 'sportspress' );
break;
case 'sp_team':
$teams = (array)get_post_meta( $post_id, 'sp_team', false );
$teams = array_filter( $teams );
if ( empty( $teams ) ):
echo '—';
echo __( 'All', 'sportspress' );
else:
$current_team = get_post_meta( $post_id, 'sp_current_team', true );
foreach( $teams as $team_id ):

View File

@@ -66,16 +66,16 @@ class SP_Admin_CPT_List extends SP_Admin_CPT {
echo sizeof( $players );
break;
case 'sp_league':
echo get_the_terms ( $post_id, 'sp_league' ) ? the_terms( $post_id, 'sp_league' ) : '—';
echo get_the_terms ( $post_id, 'sp_league' ) ? the_terms( $post_id, 'sp_league' ) : __( 'All', 'sportspress' );
break;
case 'sp_season':
echo get_the_terms ( $post_id, 'sp_season' ) ? the_terms( $post_id, 'sp_season' ) : '—';
echo get_the_terms ( $post_id, 'sp_season' ) ? the_terms( $post_id, 'sp_season' ) : __( 'All', 'sportspress' );
break;
case 'sp_team':
$teams = (array)get_post_meta( $post_id, 'sp_team', false );
$teams = array_filter( $teams );
if ( empty( $teams ) ):
echo '—';
echo __( 'All', 'sportspress' );
else:
foreach( $teams as $team_id ):
if ( ! $team_id ) continue;