diff --git a/admin/post-types/player.php b/admin/post-types/player.php index 9bd20137..a3ac513c 100644 --- a/admin/post-types/player.php +++ b/admin/post-types/player.php @@ -19,6 +19,18 @@ function sp_player_cpt_init() { } add_action( 'init', 'sp_player_cpt_init' ); +function sp_player_edit_columns() { + $columns = array( + 'cb' => '', + 'title' => __( 'Name', 'sportspress' ), + 'sp_position' => __( 'Positions', 'sportspress' ), + 'sp_team' => __( 'Teams', 'sportspress' ), + 'sp_season' => __( 'Seasons', 'sportspress' ) + ); + return $columns; +} +add_filter( 'manage_edit-sp_player_columns', 'sp_player_edit_columns' ); + function sp_player_meta_init( $post ) { $teams = (array)get_post_meta( $post->ID, 'sp_team', false ); $leagues = (array)get_the_terms( $post->ID, 'sp_season' ); @@ -33,13 +45,14 @@ function sp_player_meta_init( $post ) { add_meta_box( 'sp_statsdiv', __( 'Statistics', 'sportspress' ), 'sp_player_stats_meta', 'sp_player', 'normal', 'high' ); endif; + add_meta_box( 'sp_detailsdiv', __( 'Details', 'sportspress' ), 'sp_player_details_meta', 'sp_player', 'normal', 'high' ); add_meta_box( 'sp_profilediv', __( 'Profile' ), 'sp_player_profile_meta', 'sp_player', 'normal', 'high' ); + } function sp_player_team_meta( $post ) { sp_post_checklist( $post->ID, 'sp_team' ); sp_post_adder( 'sp_team' ); - sp_nonce(); } function sp_player_stats_meta( $post ) { @@ -176,15 +189,43 @@ function sp_player_profile_meta( $post ) { wp_editor( $post->post_content, 'content' ); } -function sp_player_edit_columns() { - $columns = array( - 'cb' => '', - 'title' => __( 'Name', 'sportspress' ), - 'sp_position' => __( 'Positions', 'sportspress' ), - 'sp_team' => __( 'Teams', 'sportspress' ), - 'sp_season' => __( 'Seasons', 'sportspress' ) +function sp_player_details_meta( $post ) { + + $number = get_post_meta( $post->ID, 'sp_number', true ); + $details = get_post_meta( $post->ID, 'sp_details', true ); + + ?> +

+

+ +

+ 'sp_statistic', + 'numberposts' => -1, + 'posts_per_page' => -1, + 'orderby' => 'menu_order', + 'order' => 'ASC', + 'meta_query' => array( + array( + 'key' => 'sp_format', + 'value' => 'custom', + ), + ), ); - return $columns; + + $vars = get_posts( $args ); + + $custom = array(); + foreach ( $vars as $var ): + ?> +

post_title; ?>

+

+ +

+ \ No newline at end of file diff --git a/admin/presets/soccer.php b/admin/presets/soccer.php index 7c6d2246..2ae959d2 100644 --- a/admin/presets/soccer.php +++ b/admin/presets/soccer.php @@ -126,11 +126,20 @@ $sportspress_sports['soccer'] = array( ), ), array( - 'post_title' => __( 'Red Cards', 'sportspress' ), - 'post_name' => 'redcards', + 'post_title' => __( 'Height', 'sportspress' ), + 'post_name' => 'height', 'meta' => array( 'sp_equation' => '', - 'sp_format' => 'integer', + 'sp_format' => 'custom', + 'sp_precision' => 1, + ), + ), + array( + 'post_title' => __( 'Weight', 'sportspress' ), + 'post_name' => 'weight', + 'meta' => array( + 'sp_equation' => '', + 'sp_format' => 'custom', 'sp_precision' => 1, ), ), diff --git a/sportspress-actions.php b/sportspress-actions.php index 3c524129..2a5be2f9 100644 --- a/sportspress-actions.php +++ b/sportspress-actions.php @@ -235,6 +235,12 @@ function sp_save_post( $post_id ) { // Update team array sp_update_post_meta_recursive( $post_id, 'sp_team', sp_array_value( $_POST, 'sp_team', array() ) ); + // Update player number + update_post_meta( $post_id, 'sp_number', sp_array_value( $_POST, 'sp_number', '' ) ); + + // Update player details array + update_post_meta( $post_id, 'sp_details', sp_array_value( $_POST, 'sp_details', array() ) ); + break; case ( 'sp_staff' ): diff --git a/sportspress-functions.php b/sportspress-functions.php index 975ecbcd..bf53644d 100644 --- a/sportspress-functions.php +++ b/sportspress-functions.php @@ -444,7 +444,14 @@ if ( !function_exists( 'sp_get_var_labels' ) ) { 'numberposts' => -1, 'posts_per_page' => -1, 'orderby' => 'menu_order', - 'order' => 'ASC' + 'order' => 'ASC', + 'meta_query' => array( + array( + 'key' => 'sp_format', + 'value' => 'custom', + 'compare' => '!=', + ), + ), ); $vars = get_posts( $args ); @@ -1260,7 +1267,14 @@ if ( !function_exists( 'sp_get_list' ) ) { 'numberposts' => -1, 'posts_per_page' => -1, 'orderby' => 'menu_order', - 'order' => 'ASC' + 'order' => 'ASC', + 'meta_query' => array( + array( + 'key' => 'sp_format', + 'value' => 'custom', + 'compare' => '!=', + ), + ), ); $statistics = get_posts( $args ); @@ -1280,7 +1294,7 @@ if ( !function_exists( 'sp_get_list' ) ) { // Add order to priorities if priority is set and does not exist in array already $priority = sp_array_value( sp_array_value( $meta, 'sp_priority', array() ), 0, 0 ); - if ( $priority && ! array_key_exists( $priorities, $priority ) ): + if ( $priority && ! array_key_exists( $priority, $priorities ) ): $priorities[ $priority ] = array( 'column' => $statistic->post_name, 'order' => sp_array_value( sp_array_value( $meta, 'sp_order', array() ), 0, 'DESC' ) diff --git a/sportspress-globals.php b/sportspress-globals.php index 6a8d0dc9..89789ab1 100644 --- a/sportspress-globals.php +++ b/sportspress-globals.php @@ -1,5 +1,4 @@