From c2024f9cae6d61594fe26680779e0d5ad4a39401 Mon Sep 17 00:00:00 2001 From: savvasha Date: Thu, 8 Nov 2018 18:25:56 +0200 Subject: [PATCH] Show DoB and Age in Data metabox of Player List --- includes/class-sp-player-list.php | 13 +++++++++++++ 1 file changed, 13 insertions(+) diff --git a/includes/class-sp-player-list.php b/includes/class-sp-player-list.php index b1398029..7d0ec593 100644 --- a/includes/class-sp-player-list.php +++ b/includes/class-sp-player-list.php @@ -608,6 +608,15 @@ class SP_Player_List extends SP_Secondary_Post { // Merge the data and placeholders arrays foreach( $placeholders as $player_id => $player_data ): + + if ( in_array( 'dob', $this->columns ) ): + $player_data['dob'] = get_the_date( get_option( 'date_format') , $player_id ); + endif; + + if ( in_array( 'age', $this->columns ) ): + $birthdayclass = new SportsPress_Birthdays(); + $player_data['age'] = $birthdayclass->get_age( get_the_date( 'm-d-Y', $player_id ) ); + endif; $player_data = array_merge( $column_order, $player_data ); $placeholders[ $player_id ] = $player_data; @@ -695,6 +704,10 @@ class SP_Player_List extends SP_Secondary_Post { $labels[ $key ] = __( 'Team', 'sportspress' ); elseif ( $key == 'position' ): $labels[ $key ] = __( 'Position', 'sportspress' ); + elseif ( $key == 'dob' ): + $labels[ $key ] = __( 'Date of Birth', 'sportspress' ); + elseif ( $key == 'age' ): + $labels[ $key ] = __( 'Age', 'sportspress' ); elseif ( array_key_exists( $key, $columns ) ): $labels[ $key ] = $columns[ $key ]; endif;