Display players as total count in admin

This commit is contained in:
Brian Miyaji
2014-04-29 14:09:12 +10:00
parent 6c2726c96c
commit 928ba49c3b

View File

@@ -46,10 +46,10 @@ class SP_Admin_CPT_List extends SP_Admin_CPT {
$columns = array( $columns = array(
'cb' => '<input type="checkbox" />', 'cb' => '<input type="checkbox" />',
'title' => __( 'Title', 'sportspress' ), 'title' => __( 'Title', 'sportspress' ),
'sp_player' => __( 'Players', 'sportspress' ),
'sp_league' => __( 'League', 'sportspress' ), 'sp_league' => __( 'League', 'sportspress' ),
'sp_season' => __( 'Season', 'sportspress' ), 'sp_season' => __( 'Season', 'sportspress' ),
'sp_team' => __( 'Team', 'sportspress' ), 'sp_team' => __( 'Team', 'sportspress' ),
'sp_player' => __( 'Players', 'sportspress' ),
'sp_views' => __( 'Views', 'sportspress' ), 'sp_views' => __( 'Views', 'sportspress' ),
); );
return $columns; return $columns;
@@ -62,7 +62,7 @@ class SP_Admin_CPT_List extends SP_Admin_CPT {
public function custom_columns( $column, $post_id ) { public function custom_columns( $column, $post_id ) {
switch ( $column ): switch ( $column ):
case 'sp_player': case 'sp_player':
echo sp_posts( $post_id, 'sp_player' ); echo sizeof( array_filter( get_post_meta( $post_id, 'sp_player' ) ) );
break; break;
case 'sp_league': case 'sp_league':
echo get_the_terms ( $post_id, 'sp_league' ) ? the_terms( $post_id, 'sp_league' ) : '&mdash;'; echo get_the_terms ( $post_id, 'sp_league' ) ? the_terms( $post_id, 'sp_league' ) : '&mdash;';