From 1a00fdb2da1aab6e0b8376a694a843a73ae3413d Mon Sep 17 00:00:00 2001 From: Brian Miyaji Date: Wed, 26 Mar 2014 10:53:01 +1100 Subject: [PATCH] Remove old post type functions --- admin/post-types/calendar.php | 167 --------------------- admin/post-types/column.php | 98 ------------ admin/post-types/directory.php | 165 -------------------- admin/post-types/event.php | 235 ----------------------------- admin/post-types/list.php | 176 ---------------------- admin/post-types/metric.php | 38 ----- admin/post-types/outcome.php | 53 ------- admin/post-types/performance.php | 55 ------- admin/post-types/player.php | 250 ------------------------------- admin/post-types/result.php | 54 ------- admin/post-types/separator.php | 13 -- admin/post-types/staff.php | 56 ------- admin/post-types/table.php | 118 --------------- admin/post-types/team.php | 76 ---------- sportspress.php | 17 --- 15 files changed, 1571 deletions(-) delete mode 100644 admin/post-types/calendar.php delete mode 100644 admin/post-types/column.php delete mode 100644 admin/post-types/directory.php delete mode 100644 admin/post-types/event.php delete mode 100644 admin/post-types/list.php delete mode 100644 admin/post-types/metric.php delete mode 100644 admin/post-types/outcome.php delete mode 100644 admin/post-types/performance.php delete mode 100644 admin/post-types/player.php delete mode 100644 admin/post-types/result.php delete mode 100644 admin/post-types/separator.php delete mode 100644 admin/post-types/staff.php delete mode 100644 admin/post-types/table.php delete mode 100644 admin/post-types/team.php diff --git a/admin/post-types/calendar.php b/admin/post-types/calendar.php deleted file mode 100644 index 8acb84a9..00000000 --- a/admin/post-types/calendar.php +++ /dev/null @@ -1,167 +0,0 @@ - __( 'Calendars', 'sportspress' ), - 'singular_name' => __( 'Calendar', 'sportspress' ), - 'add_new_item' => __( 'Add New Calendar', 'sportspress' ), - 'edit_item' => __( 'Edit Calendar', 'sportspress' ), - 'new_item' => __( 'New', 'sportspress' ), - 'view_item' => __( 'View', 'sportspress' ), - 'search_items' => __( 'Search', 'sportspress' ), - 'not_found' => __( 'No results found.', 'sportspress' ), - 'not_found_in_trash' => __( 'No results found.', 'sportspress' ), - ); - $args = array( - 'label' => __( 'Calendars', 'sportspress' ), - 'labels' => $labels, - 'public' => true, - 'has_archive' => false, - 'hierarchical' => false, - 'supports' => array( 'title', 'author', 'thumbnail' ), - 'register_meta_box_cb' => 'sportspress_calendar_meta_init', - 'rewrite' => array( 'slug' => get_option( 'sportspress_calendar_slug', 'calendar' ) ), - 'show_in_menu' => 'edit.php?post_type=sp_event', - 'show_in_admin_bar' => true, - 'capability_type' => 'sp_calendar', - ); - register_post_type( 'sp_calendar', $args ); -} -add_action( 'init', 'sportspress_calendar_post_init' ); - -function sportspress_calendar_edit_columns() { - $columns = array( - 'cb' => '', - 'title' => __( 'Title', 'sportspress' ), - 'sp_league' => __( 'League', 'sportspress' ), - 'sp_season' => __( 'Season', 'sportspress' ), - 'sp_venue' => __( 'Venue', 'sportspress' ), - 'sp_team' => __( 'Teams', 'sportspress' ), - 'sp_events' => __( 'Events', 'sportspress' ), - 'sp_views' => __( 'Views', 'sportspress' ), - ); - return $columns; -} -add_filter( 'manage_edit-sp_calendar_columns', 'sportspress_calendar_edit_columns' ); - -function sportspress_calendar_meta_init( $post ) { - $teams = (array)get_post_meta( $post->ID, 'sp_team', false ); - - remove_meta_box( 'sp_seasondiv', 'sp_calendar', 'side' ); - remove_meta_box( 'sp_leaguediv', 'sp_calendar', 'side' ); - remove_meta_box( 'sp_venuediv', 'sp_calendar', 'side' ); - add_meta_box( 'sp_shortcodediv', __( 'Shortcode', 'sportspress' ), 'sportspress_calendar_shortcode_meta', 'sp_calendar', 'side', 'default' ); - add_meta_box( 'sp_formatdiv', __( 'Format', 'sportspress' ), 'sportspress_calendar_format_meta', 'sp_calendar', 'side', 'default' ); - add_meta_box( 'sp_detailsdiv', __( 'Details', 'sportspress' ), 'sportspress_calendar_details_meta', 'sp_calendar', 'side', 'default' ); - add_meta_box( 'sp_columnsdiv', __( 'Events', 'sportspress' ), 'sportspress_calendar_events_meta', 'sp_calendar', 'normal', 'high' ); - add_meta_box( 'sp_descriptiondiv', __( 'Description', 'sportspress' ), 'sportspress_calendar_description_meta', 'sp_calendar', 'normal', 'high' ); -} - -function sportspress_calendar_shortcode_meta( $post ) { - $the_format = get_post_meta( $post->ID, 'sp_format', true ); - ?> -

- -

-

- ID, 'sp_format', true ); - ?> -
- $format ): ?> - >
- -
- ID, 'sp_league', 0 ); - $season_id = sportspress_get_the_term_id( $post->ID, 'sp_season', 0 ); - $venue_id = sportspress_get_the_term_id( $post->ID, 'sp_venue', 0 ); - $team_id = get_post_meta( $post->ID, 'sp_team', true ); - $formats = get_post_meta( $post->ID, 'sp_format' ); - ?> -
-

-

- __( 'All', 'sportspress' ), - 'taxonomy' => 'sp_league', - 'name' => 'sp_league', - 'selected' => $league_id, - 'values' => 'term_id' - ); - if ( ! sportspress_dropdown_taxonomies( $args ) ): - sportspress_taxonomy_adder( 'sp_league', 'sp_team', __( 'Add New', 'sportspress' ) ); - endif; - ?> -

-

-

- __( 'All', 'sportspress' ), - 'taxonomy' => 'sp_season', - 'name' => 'sp_season', - 'selected' => $season_id, - 'values' => 'term_id' - ); - if ( ! sportspress_dropdown_taxonomies( $args ) ): - sportspress_taxonomy_adder( 'sp_season', 'sp_team', __( 'Add New', 'sportspress' ) ); - endif; - ?> -

-

-

- __( 'All', 'sportspress' ), - 'taxonomy' => 'sp_venue', - 'name' => 'sp_venue', - 'selected' => $venue_id, - 'values' => 'term_id' - ); - if ( ! sportspress_dropdown_taxonomies( $args ) ): - sportspress_taxonomy_adder( 'sp_season', 'sp_team', __( 'Add New', 'sportspress' ) ); - endif; - ?> -

-

-

- __( 'All', 'sportspress' ), - 'post_type' => 'sp_team', - 'name' => 'sp_team', - 'selected' => $team_id, - 'values' => 'ID' - ); - if ( ! sportspress_dropdown_pages( $args ) ): - sportspress_post_adder( 'sp_team', __( 'Add New', 'sportspress' ) ); - endif; - ?> -

-
- ID, true ); - - sportspress_edit_calendar_table( $data, $usecolumns ); - - sportspress_nonce(); - -} - -function sportspress_calendar_description_meta( $post ) { - wp_editor( $post->post_content, 'content' ); -} diff --git a/admin/post-types/column.php b/admin/post-types/column.php deleted file mode 100644 index a351b944..00000000 --- a/admin/post-types/column.php +++ /dev/null @@ -1,98 +0,0 @@ - __( 'Columns', 'sportspress' ), - 'singular_name' => __( 'Column', 'sportspress' ), - 'add_new_item' => __( 'Add New Column', 'sportspress' ), - 'edit_item' => __( 'Edit Column', 'sportspress' ), - 'new_item' => __( 'New', 'sportspress' ), - 'view_item' => __( 'View', 'sportspress' ), - 'search_items' => __( 'Search', 'sportspress' ), - 'not_found' => __( 'No results found.', 'sportspress' ), - 'not_found_in_trash' => __( 'No results found.', 'sportspress' ), - ); - $args = array( - 'label' => __( 'Columns', 'sportspress' ), - 'labels' => $labels, - 'public' => false, - 'show_ui' => true, - 'show_in_menu' => false, - 'has_archive' => false, - 'hierarchical' => false, - 'can_export' => false, - 'supports' => array( 'title', 'page-attributes' ), - 'register_meta_box_cb' => 'sportspress_column_meta_init', - 'capability_type' => 'sp_config', - ); - register_post_type( 'sp_column', $args ); -} -add_action( 'init', 'sportspress_column_post_init' ); - -function sportspress_column_edit_columns() { - $columns = array( - 'cb' => '', - 'title' => __( 'Label', 'sportspress' ), - 'sp_key' => __( 'Key', 'sportspress' ), - 'sp_equation' => __( 'Equation', 'sportspress' ), - 'sp_precision' => __( 'Rounding', 'sportspress' ), - 'sp_order' => __( 'Sort Order', 'sportspress' ), - ); - return $columns; -} -add_filter( 'manage_edit-sp_column_columns', 'sportspress_column_edit_columns' ); - -function sportspress_column_meta_init() { - add_meta_box( 'sp_detailsdiv', __( 'Details', 'sportspress' ), 'sportspress_column_details_meta', 'sp_column', 'normal', 'high' ); -} - -function sportspress_column_details_meta( $post ) { - $equation = explode( ' ', get_post_meta( $post->ID, 'sp_equation', true ) ); - $order = get_post_meta( $post->ID, 'sp_order', true ); - $priority = get_post_meta( $post->ID, 'sp_priority', true ); - $precision = get_post_meta( $post->ID, 'sp_precision', true ); - - // Defaults - if ( $precision == '' ) $precision = 0; - ?> -

-

- -

-

-

- ID, $piece, array( 'team_event', 'result', 'outcome' ) ); - endforeach; - ?> -

-

-

- -

-

-

- - -

- __( 'Directories', 'sportspress' ), - 'singular_name' => __( 'Directory', 'sportspress' ), - 'add_new_item' => __( 'Add New Directory', 'sportspress' ), - 'edit_item' => __( 'Edit Directory', 'sportspress' ), - 'new_item' => __( 'New', 'sportspress' ), - 'view_item' => __( 'View', 'sportspress' ), - 'search_items' => __( 'Search', 'sportspress' ), - 'not_found' => __( 'No results found.', 'sportspress' ), - 'not_found_in_trash' => __( 'No results found.', 'sportspress' ), - ); - $args = array( - 'label' => __( 'Directories', 'sportspress' ), - 'labels' => $labels, - 'public' => true, - 'has_archive' => false, - 'hierarchical' => false, - 'supports' => array( 'title', 'author', 'thumbnail' ), - 'register_meta_box_cb' => 'sportspress_directory_meta_init', - 'rewrite' => array( 'slug' => get_option( 'sportspress_directory_slug', 'directory' ) ), - 'show_in_menu' => 'edit.php?post_type=sp_player', - 'show_in_admin_bar' => true, - 'capability_type' => 'sp_directory', - ); - register_post_type( 'sp_directory', $args ); -} -add_action( 'init', 'sportspress_directory_post_init' ); - -function sportspress_directory_edit_columns() { - $columns = array( - 'cb' => '', - 'title' => __( 'Title', 'sportspress' ), - 'sp_staff' => __( 'Staff', 'sportspress' ), - 'sp_league' => __( 'League', 'sportspress' ), - 'sp_season' => __( 'Season', 'sportspress' ), - 'sp_team' => __( 'Team', 'sportspress' ), - 'sp_views' => __( 'Views', 'sportspress' ), - ); - return $columns; -} -add_filter( 'manage_edit-sp_directory_columns', 'sportspress_directory_edit_columns' ); - -function sportspress_directory_meta_init( $post ) { - $players = (array)get_post_meta( $post->ID, 'sp_staff', false ); - - remove_meta_box( 'sp_seasondiv', 'sp_directory', 'side' ); - remove_meta_box( 'sp_leaguediv', 'sp_directory', 'side' ); - add_meta_box( 'sp_formatdiv', __( 'Format', 'sportspress' ), 'sportspress_directory_format_meta', 'sp_directory', 'side', 'high' ); - add_meta_box( 'sp_detailsdiv', __( 'Details', 'sportspress' ), 'sportspress_directory_details_meta', 'sp_directory', 'side', 'high' ); - //add_meta_box( 'sp_columnsdiv', __( 'Staff List', 'sportspress' ), 'sportspress_directory_columns_meta', 'sp_directory', 'normal', 'high' ); - add_meta_box( 'sp_descriptiondiv', __( 'Description', 'sportspress' ), 'sportspress_directory_description_meta', 'sp_directory', 'normal', 'high' ); -} - -function sportspress_directory_format_meta( $post ) { - global $sportspress_formats; - $the_format = get_post_meta( $post->ID, 'sp_format', true ); - ?> -
- $format ): ?> - >
- -
- ID, 'sp_league', 0 ); - $season_id = sportspress_get_the_term_id( $post->ID, 'sp_season', 0 ); - $team_id = get_post_meta( $post->ID, 'sp_team', true ); - $orderby = get_post_meta( $post->ID, 'sp_orderby', true ); - $order = get_post_meta( $post->ID, 'sp_order', true ); - ?> -
-

-

- 'sp_league', - 'name' => 'sp_league', - 'selected' => $league_id, - 'values' => 'term_id', - ); - if ( ! sportspress_dropdown_taxonomies( $args ) ): - sportspress_taxonomy_adder( 'sp_league', 'sp_team', __( 'Add New', 'sportspress' ) ); - endif; - ?> -

-

-

- 'sp_season', - 'name' => 'sp_season', - 'selected' => $season_id, - 'values' => 'term_id', - ); - if ( ! sportspress_dropdown_taxonomies( $args ) ): - sportspress_taxonomy_adder( 'sp_season', 'sp_team', __( 'Add New', 'sportspress' ) ); - endif; - ?> -

-

-

- 'sp_team', - 'name' => 'sp_team', - 'show_option_all' => __( 'All', 'sportspress' ), - 'selected' => $team_id, - 'values' => 'ID', - ); - if ( ! sportspress_dropdown_pages( $args ) ): - sportspress_post_adder( 'sp_team', __( 'Add New', 'sportspress' ) ); - endif; - ?> -

-

-

- array( - 'number' => __( 'Number', 'sportspress' ), - 'name' => __( 'Name', 'sportspress' ), - 'eventsplayed' => __( 'Played', 'sportspress' ) - ), - 'post_type' => 'sp_performance', - 'name' => 'sp_orderby', - 'selected' => $orderby, - 'values' => 'slug', - ); - if ( ! sportspress_dropdown_pages( $args ) ): - sportspress_post_adder( 'sp_directory', __( 'Add New', 'sportspress' ) ); - endif; - ?> -

-

-

- -

-

- ID, 'sp_staff', 'block', 'sp_team' ); - sportspress_post_adder( 'sp_staff', __( 'Add New', 'sportspress' ) ); - ?> -
- ID, true ); - - sportspress_edit_player_list_table( $columns, $usecolumns, $data, $placeholders ); - sportspress_nonce(); -} - -function sportspress_directory_description_meta( $post ) { - wp_editor( $post->post_content, 'content' ); -} diff --git a/admin/post-types/event.php b/admin/post-types/event.php deleted file mode 100644 index cb225446..00000000 --- a/admin/post-types/event.php +++ /dev/null @@ -1,235 +0,0 @@ - __( 'Schedule', 'sportspress' ), - 'singular_name' => __( 'Event', 'sportspress' ), - 'all_items' => __( 'Events', 'sportspress' ), - 'add_new_item' => __( 'Add New Event', 'sportspress' ), - 'edit_item' => __( 'Edit Event', 'sportspress' ), - 'new_item' => __( 'New', 'sportspress' ), - 'view_item' => __( 'View', 'sportspress' ), - 'search_items' => __( 'Search', 'sportspress' ), - 'not_found' => __( 'No results found.', 'sportspress' ), - 'not_found_in_trash' => __( 'No results found.', 'sportspress' ), - ); - $args = array( - 'label' => __( 'Events', 'sportspress' ), - 'labels' => $labels, - 'public' => true, - 'has_archive' => true, - 'hierarchical' => false, - 'supports' => array( 'title', 'author', 'thumbnail', 'comments' ), - 'register_meta_box_cb' => 'sportspress_event_meta_init', - 'rewrite' => array( 'slug' => get_option( 'sportspress_events_slug', 'events' ) ), - 'menu_icon' => 'dashicons-calendar', - 'capability_type' => 'sp_event', - ); - register_post_type( 'sp_event', $args ); -} -add_action( 'init', 'sportspress_event_post_init' ); - -function sportspress_event_meta_init( $post ) { - $teams = (array)get_post_meta( $post->ID, 'sp_team', false ); - $players = (array)get_post_meta( $post->ID, 'sp_player', false ); - - remove_meta_box( 'submitdiv', 'sp_event', 'side' ); - remove_meta_box( 'sp_venuediv', 'sp_event', 'side' ); - remove_meta_box( 'sp_leaguediv', 'sp_event', 'side' ); - remove_meta_box( 'sp_seasondiv', 'sp_event', 'side' ); - - add_meta_box( 'submitdiv', __( 'Event', 'sportspress' ), 'post_submit_meta_box', 'sp_event', 'side', 'default' ); - add_meta_box( 'sp_formatdiv', __( 'Format', 'sportspress' ), 'sportspress_event_format_meta', 'sp_event', 'side', 'default' ); - add_meta_box( 'sp_detailsdiv', __( 'Details', 'sportspress' ), 'sportspress_event_details_meta', 'sp_event', 'side', 'default' ); - add_meta_box( 'sp_teamdiv', __( 'Teams', 'sportspress' ), 'sportspress_event_team_meta', 'sp_event', 'side', 'default' ); - add_meta_box( 'sp_videodiv', __( 'Video', 'sportspress' ), 'sportspress_event_video_meta', 'sp_event', 'side', 'low' ); - if ( sizeof( $teams ) > 0 ) - add_meta_box( 'sp_resultsdiv', __( 'Results', 'sportspress' ), 'sportspress_event_results_meta', 'sp_event', 'normal', 'high' ); - - do_action( 'sportspress_event_meta_init' ); - - if ( sizeof( $players ) > 0 ) - add_meta_box( 'sp_performancediv', __( 'Performance', 'sportspress' ), 'sportspress_event_performance_meta', 'sp_event', 'normal', 'high' ); - add_meta_box( 'sp_articlediv', __( 'Article', 'sportspress' ), 'sportspress_event_article_meta', 'sp_event', 'normal', 'high' ); -} - -function sportspress_event_format_meta( $post ) { - global $sportspress_formats; - $the_format = get_post_meta( $post->ID, 'sp_format', true ); - ?> -
- $format ): ?> - >
- -
- ID, 'sp_type', null ); - $league_id = sportspress_get_the_term_id( $post->ID, 'sp_league', 0 ); - $season_id = sportspress_get_the_term_id( $post->ID, 'sp_season', 0 ); - $venue_id = sportspress_get_the_term_id( $post->ID, 'sp_venue', 0 ); - ?> -
-
-

-

- 'sp_league', - 'name' => 'sp_league', - 'selected' => $league_id, - 'values' => 'term_id', - 'show_option_none' => __( '-- Not set --', 'sportspress' ), - ); - if ( ! sportspress_dropdown_taxonomies( $args ) ): - sportspress_taxonomy_adder( 'sp_league', 'sp_team', __( 'Add New', 'sportspress' ) ); - endif; - ?> -

-

-

- 'sp_season', - 'name' => 'sp_season', - 'selected' => $season_id, - 'values' => 'term_id', - 'show_option_none' => __( '-- Not set --', 'sportspress' ), - ); - if ( ! sportspress_dropdown_taxonomies( $args ) ): - sportspress_taxonomy_adder( 'sp_season', 'sp_team', __( 'Add New', 'sportspress' ) ); - endif; - ?> -

-
-

-

- 'sp_venue', - 'name' => 'sp_venue', - 'selected' => $venue_id, - 'values' => 'term_id', - 'show_option_none' => __( '-- Not set --', 'sportspress' ), - ); - if ( ! sportspress_dropdown_taxonomies( $args ) ): - sportspress_taxonomy_adder( 'sp_venue', 'sp_event', __( 'Add New', 'sportspress' ) ); - endif; - ?> -

-
- ID, 'sp_team', false ); - foreach ( $teams as $key => $value ): - ?> -
-

- 'sp_team', - 'name' => 'sp_team[]', - 'class' => 'sportspress-pages', - 'show_option_none' => sprintf( __( 'Remove', 'sportspress' ), 'Team' ), - 'option_none_value' => '0', - 'selected' => $value - ); - wp_dropdown_pages( $args ); - ?> -

- - ID, 'sp_player', 'block', 'sp_current_team', $key ); - sportspress_post_checklist( $post->ID, 'sp_staff', 'none', 'sp_current_team', $key ); - ?> -
- -
-

- 'sp_team', - 'name' => 'sp_team_selector', - 'class' => 'sportspress-pages', - 'show_option_none' => __( '— Add —', 'sportspress' ), - 'option_none_value' => '0' - ); - wp_dropdown_pages( $args ); - ?> -

-
- ID, 'sp_video', true ); - if ( $video ): - ?> -
- -

-
- - -
-

-
- ID, 'sp_team', false ); - $stats = (array)get_post_meta( $post->ID, 'sp_players', true ); - - // Get columns from performance variables - $columns = sportspress_get_var_labels( 'sp_performance' ); - - foreach ( $teams as $key => $team_id ): - if ( ! $team_id ) continue; - - // Get results for players in the team - $players = sportspress_array_between( (array)get_post_meta( $post->ID, 'sp_player', false ), 0, $key ); - $data = sportspress_array_combine( $players, sportspress_array_value( $stats, $team_id, array() ) ); - - ?> -
-

- -
- ID, 'sp_team', false ); - - $results = (array)get_post_meta( $post->ID, 'sp_results', true ); - - // Get columns from result variables - $columns = sportspress_get_var_labels( 'sp_result' ); - - // Get results for all teams - $data = sportspress_array_combine( $teams, $results ); - - ?> -
- -
- post_content, 'content' ); -} diff --git a/admin/post-types/list.php b/admin/post-types/list.php deleted file mode 100644 index 3843b96b..00000000 --- a/admin/post-types/list.php +++ /dev/null @@ -1,176 +0,0 @@ - __( 'Player Lists', 'sportspress' ), - 'singular_name' => __( 'Player List', 'sportspress' ), - 'add_new_item' => __( 'Add New Player List', 'sportspress' ), - 'edit_item' => __( 'Edit Player List', 'sportspress' ), - 'new_item' => __( 'New', 'sportspress' ), - 'view_item' => __( 'View', 'sportspress' ), - 'search_items' => __( 'Search', 'sportspress' ), - 'not_found' => __( 'No results found.', 'sportspress' ), - 'not_found_in_trash' => __( 'No results found.', 'sportspress' ), - ); - $args = array( - 'label' => __( 'Player Lists', 'sportspress' ), - 'labels' => $labels, - 'public' => true, - 'has_archive' => false, - 'hierarchical' => false, - 'supports' => array( 'title', 'author', 'thumbnail' ), - 'register_meta_box_cb' => 'sportspress_list_meta_init', - 'rewrite' => array( 'slug' => get_option( 'sportspress_list_slug', 'list' ) ), - 'show_in_menu' => 'edit.php?post_type=sp_player', - 'show_in_admin_bar' => true, - 'capability_type' => 'sp_list', - ); - register_post_type( 'sp_list', $args ); -} -add_action( 'init', 'sportspress_list_post_init' ); - -function sportspress_list_edit_columns() { - $columns = array( - 'cb' => '', - 'title' => __( 'Title', 'sportspress' ), - 'sp_player' => __( 'Players', 'sportspress' ), - 'sp_league' => __( 'League', 'sportspress' ), - 'sp_season' => __( 'Season', 'sportspress' ), - 'sp_team' => __( 'Team', 'sportspress' ), - 'sp_views' => __( 'Views', 'sportspress' ), - ); - return $columns; -} -add_filter( 'manage_edit-sp_list_columns', 'sportspress_list_edit_columns' ); - -function sportspress_list_meta_init( $post ) { - $players = (array)get_post_meta( $post->ID, 'sp_player', false ); - - remove_meta_box( 'sp_seasondiv', 'sp_list', 'side' ); - remove_meta_box( 'sp_leaguediv', 'sp_list', 'side' ); - add_meta_box( 'sp_shortcodediv', __( 'Shortcode', 'sportspress' ), 'sportspress_list_shortcode_meta', 'sp_list', 'side', 'default' ); - add_meta_box( 'sp_formatdiv', __( 'Format', 'sportspress' ), 'sportspress_list_format_meta', 'sp_list', 'side', 'default' ); - add_meta_box( 'sp_detailsdiv', __( 'Details', 'sportspress' ), 'sportspress_list_details_meta', 'sp_list', 'side', 'default' ); - add_meta_box( 'sp_statsdiv', __( 'Player List', 'sportspress' ), 'sportspress_list_stats_meta', 'sp_list', 'normal', 'default' ); - add_meta_box( 'sp_descriptiondiv', __( 'Description', 'sportspress' ), 'sportspress_list_description_meta', 'sp_list', 'normal', 'high' ); -} - -function sportspress_list_shortcode_meta( $post ) { - $the_format = get_post_meta( $post->ID, 'sp_format', true ); - ?> -

- -

-

- ID, 'sp_format', true ); - ?> -
- $format ): ?> - >
- -
- ID, 'sp_league', 0 ); - $season_id = sportspress_get_the_term_id( $post->ID, 'sp_season', 0 ); - $team_id = get_post_meta( $post->ID, 'sp_team', true ); - $orderby = get_post_meta( $post->ID, 'sp_orderby', true ); - $order = get_post_meta( $post->ID, 'sp_order', true ); - ?> -
-

-

- 'sp_league', - 'name' => 'sp_league', - 'selected' => $league_id, - 'values' => 'term_id', - ); - if ( ! sportspress_dropdown_taxonomies( $args ) ): - sportspress_taxonomy_adder( 'sp_league', 'sp_team', __( 'Add New', 'sportspress' ) ); - endif; - ?> -

-

-

- 'sp_season', - 'name' => 'sp_season', - 'selected' => $season_id, - 'values' => 'term_id', - ); - if ( ! sportspress_dropdown_taxonomies( $args ) ): - sportspress_taxonomy_adder( 'sp_season', 'sp_team', __( 'Add New', 'sportspress' ) ); - endif; - ?> -

-

-

- 'sp_team', - 'name' => 'sp_team', - 'show_option_all' => __( 'All', 'sportspress' ), - 'selected' => $team_id, - 'values' => 'ID', - ); - if ( ! sportspress_dropdown_pages( $args ) ): - sportspress_post_adder( 'sp_team', __( 'Add New', 'sportspress' ) ); - endif; - ?> -

-

-

- array( - 'number' => __( 'Number', 'sportspress' ), - 'name' => __( 'Name', 'sportspress' ), - 'eventsplayed' => __( 'Played', 'sportspress' ) - ), - 'post_type' => 'sp_performance', - 'name' => 'sp_orderby', - 'selected' => $orderby, - 'values' => 'slug', - ); - if ( ! sportspress_dropdown_pages( $args ) ): - sportspress_post_adder( 'sp_list', __( 'Add New', 'sportspress' ) ); - endif; - ?> -

-

-

- -

-

- ID, 'sp_player', 'block', 'sp_team' ); - sportspress_post_adder( 'sp_player', __( 'Add New', 'sportspress' ) ); - ?> -
- ID, true ); - - sportspress_edit_player_list_table( $columns, $usecolumns, $data, $placeholders ); - sportspress_nonce(); -} - -function sportspress_list_description_meta( $post ) { - wp_editor( $post->post_content, 'content' ); -} diff --git a/admin/post-types/metric.php b/admin/post-types/metric.php deleted file mode 100644 index ee56e73f..00000000 --- a/admin/post-types/metric.php +++ /dev/null @@ -1,38 +0,0 @@ - __( 'Metrics', 'sportspress' ), - 'singular_name' => __( 'Metric', 'sportspress' ), - 'add_new_item' => __( 'Add New Metric', 'sportspress' ), - 'edit_item' => __( 'Edit Metric', 'sportspress' ), - 'new_item' => __( 'New', 'sportspress' ), - 'view_item' => __( 'View', 'sportspress' ), - 'search_items' => __( 'Search', 'sportspress' ), - 'not_found' => __( 'No results found.', 'sportspress' ), - 'not_found_in_trash' => __( 'No results found.', 'sportspress' ), - ); - $args = array( - 'label' => __( 'Metrics', 'sportspress' ), - 'labels' => $labels, - 'public' => false, - 'show_ui' => true, - 'show_in_menu' => false, - 'has_archive' => false, - 'hierarchical' => false, - 'can_export' => false, - 'supports' => array( 'title', 'page-attributes' ), - 'capability_type' => 'sp_config', - ); - register_post_type( 'sp_metric', $args ); -} -add_action( 'init', 'sportspress_metric_post_init' ); - -function sportspress_metric_edit_columns() { - $columns = array( - 'cb' => '', - 'title' => __( 'Label', 'sportspress' ), - 'sp_positions' => __( 'Positions', 'sportspress' ), - ); - return $columns; -} -add_filter( 'manage_edit-sp_metric_columns', 'sportspress_metric_edit_columns' ); diff --git a/admin/post-types/outcome.php b/admin/post-types/outcome.php deleted file mode 100644 index 4b4644b7..00000000 --- a/admin/post-types/outcome.php +++ /dev/null @@ -1,53 +0,0 @@ - __( 'Outcomes', 'sportspress' ), - 'singular_name' => __( 'Outcome', 'sportspress' ), - 'add_new_item' => __( 'Add New Outcome', 'sportspress' ), - 'edit_item' => __( 'Edit Outcome', 'sportspress' ), - 'new_item' => __( 'New', 'sportspress' ), - 'view_item' => __( 'View', 'sportspress' ), - 'search_items' => __( 'Search', 'sportspress' ), - 'not_found' => __( 'No results found.', 'sportspress' ), - 'not_found_in_trash' => __( 'No results found.', 'sportspress' ), - ); - $args = array( - 'label' => __( 'Outcomes', 'sportspress' ), - 'labels' => $labels, - 'public' => false, - 'show_ui' => true, - 'show_in_menu' => false, - 'has_archive' => false, - 'hierarchical' => false, - 'can_export' => false, - 'supports' => array( 'title', 'page-attributes' ), - 'register_meta_box_cb' => 'sportspress_outcome_meta_init', - 'capability_type' => 'sp_config', - ); - register_post_type( 'sp_outcome', $args ); -} -add_action( 'init', 'sportspress_outcome_post_init' ); - -function sportspress_outcome_edit_columns() { - $columns = array( - 'cb' => '', - 'title' => __( 'Label', 'sportspress' ), - 'sp_key' => __( 'Key', 'sportspress' ), - ); - return $columns; -} -add_filter( 'manage_edit-sp_outcome_columns', 'sportspress_outcome_edit_columns' ); - -function sportspress_outcome_meta_init() { - add_meta_box( 'sp_detailsdiv', __( 'Details', 'sportspress' ), 'sportspress_outcome_details_meta', 'sp_outcome', 'normal', 'high' ); -} - -function sportspress_outcome_details_meta( $post ) { -?> -

-

- -

- __( 'Performance', 'sportspress' ), - 'singular_name' => __( 'Performance', 'sportspress' ), - 'add_new_item' => __( 'Add New Performance', 'sportspress' ), - 'edit_item' => __( 'Edit Performance', 'sportspress' ), - 'new_item' => __( 'New', 'sportspress' ), - 'view_item' => __( 'View', 'sportspress' ), - 'search_items' => __( 'Search', 'sportspress' ), - 'not_found' => __( 'No results found.', 'sportspress' ), - 'not_found_in_trash' => __( 'No results found.', 'sportspress' ), - ); - $args = array( - 'label' => __( 'Performance', 'sportspress' ), - 'labels' => $labels, - 'public' => false, - 'show_ui' => true, - 'show_in_menu' => false, - 'has_archive' => false, - 'hierarchical' => false, - 'can_export' => false, - 'supports' => array( 'title', 'page-attributes' ), - 'register_meta_box_cb' => 'sportspress_performance_meta_init', - 'capability_type' => 'sp_config', - ); - register_post_type( 'sp_performance', $args ); -} -add_action( 'init', 'sportspress_performance_post_init' ); - -function sportspress_performance_edit_columns() { - $columns = array( - 'cb' => '', - 'title' => __( 'Label', 'sportspress' ), - 'sp_positions' => __( 'Positions', 'sportspress' ), - 'sp_calculate' => __( 'Calculate', 'sportspress' ), - ); - return $columns; -} -add_filter( 'manage_edit-sp_performance_columns', 'sportspress_performance_edit_columns' ); - -function sportspress_performance_meta_init() { - add_meta_box( 'sp_equationdiv', __( 'Details', 'sportspress' ), 'sportspress_performance_equation_meta', 'sp_performance', 'normal', 'high' ); -} - -function sportspress_performance_equation_meta( $post ) { - $calculate = get_post_meta( $post->ID, 'sp_calculate', true ); - ?> -

-

- ID, $calculate ); ?> -

- __( 'Players', 'sportspress' ), - 'singular_name' => __( 'Player', 'sportspress' ), - 'menu_name' => __( 'Roster', 'sportspress' ), - 'all_items' => __( 'Players', 'sportspress' ), - 'add_new_item' => __( 'Add New Player', 'sportspress' ), - 'edit_item' => __( 'Edit Player', 'sportspress' ), - 'new_item' => __( 'New', 'sportspress' ), - 'view_item' => __( 'View', 'sportspress' ), - 'search_items' => __( 'Search', 'sportspress' ), - 'not_found' => __( 'No results found.', 'sportspress' ), - 'not_found_in_trash' => __( 'No results found.', 'sportspress' ), - ); - $args = array( - 'label' => __( 'Players', 'sportspress' ), - 'labels' => $labels, - 'public' => true, - 'has_archive' => false, - 'hierarchical' => false, - 'supports' => array( 'title', 'editor', 'author', 'thumbnail', 'excerpt', 'page-attributes' ), - 'register_meta_box_cb' => 'sportspress_player_meta_init', - 'rewrite' => array( 'slug' => get_option( 'sportspress_players_slug', 'players' ) ), - 'menu_icon' => 'dashicons-groups', - 'capability_type' => 'sp_player', - ); - register_post_type( 'sp_player', $args ); -} -add_action( 'init', 'sportspress_player_post_init' ); - -function sportspress_player_edit_columns() { - $columns = array( - 'cb' => '', - 'sp_number' => '', - 'title' => __( 'Player', 'sportspress' ), - 'sp_position' => __( 'Positions', 'sportspress' ), - 'sp_team' => __( 'Teams', 'sportspress' ), - 'sp_league' => __( 'Leagues', 'sportspress' ), - 'sp_season' => __( 'Seasons', 'sportspress' ), - 'sp_views' => __( 'Views', 'sportspress' ), - ); - return $columns; -} -add_filter( 'manage_edit-sp_player_columns', 'sportspress_player_edit_columns' ); - -function sportspress_player_meta_init( $post ) { - $leagues = get_the_terms( $post->ID, 'sp_league' ); - $seasons = (array)get_the_terms( $post->ID, 'sp_season' ); - - remove_meta_box( 'sp_seasondiv', 'sp_player', 'side' ); - remove_meta_box( 'sp_leaguediv', 'sp_player', 'side' ); - remove_meta_box( 'sp_positiondiv', 'sp_player', 'side' ); - - add_meta_box( 'sp_detailsdiv', __( 'Details', 'sportspress' ), 'sportspress_player_details_meta', 'sp_player', 'side', 'default' ); - add_meta_box( 'sp_metricsdiv', __( 'Metrics', 'sportspress' ), 'sportspress_player_metrics_meta', 'sp_player', 'side', 'default' ); - - if ( $leagues && ! empty( $leagues ) && $seasons && ! empty( $seasons ) ): - add_meta_box( 'sp_performancediv', __( 'Performance', 'sportspress' ), 'sportspress_player_performance_meta', 'sp_player', 'normal', 'high' ); - endif; -} - -function sportspress_player_details_meta( $post ) { - $continents = SP()->countries->continents; - - $number = get_post_meta( $post->ID, 'sp_number', true ); - $nationality = get_post_meta( $post->ID, 'sp_nationality', true ); - - $leagues = get_the_terms( $post->ID, 'sp_league' ); - $league_ids = array(); - if ( $leagues ): - foreach ( $leagues as $league ): - $league_ids[] = $league->term_id; - endforeach; - endif; - - $seasons = get_the_terms( $post->ID, 'sp_season' ); - $season_ids = array(); - if ( $seasons ): - foreach ( $seasons as $season ): - $season_ids[] = $season->term_id; - endforeach; - endif; - - $positions = get_the_terms( $post->ID, 'sp_position' ); - $position_ids = array(); - if ( $positions ): - foreach ( $positions as $position ): - $position_ids[] = $position->term_id; - endforeach; - endif; - - $teams = get_posts( array( 'post_type' => 'sp_team', 'posts_per_page' => -1 ) ); - $past_teams = array_filter( get_post_meta( $post->ID, 'sp_past_team', false ) ); - $current_team = get_post_meta( $post->ID, 'sp_current_team', true ); - ?> -

-

- -

-

- -

-

'sp_position', - 'name' => 'tax_input[sp_position][]', - 'selected' => $position_ids, - 'values' => 'term_id', - 'placeholder' => sprintf( __( 'Select %s', 'sportspress' ), __( 'Positions', 'sportspress' ) ), - 'class' => 'widefat', - 'property' => 'multiple', - 'chosen' => true, - ); - sportspress_dropdown_taxonomies( $args ); - ?>

- -

-

'sp_team', - 'name' => 'sp_current_team', - 'show_option_blank' => true, - 'selected' => $current_team, - 'values' => 'ID', - 'placeholder' => sprintf( __( 'Select %s', 'sportspress' ), __( 'Team', 'sportspress' ) ), - 'class' => 'sp-current-team widefat', - 'chosen' => true, - ); - sportspress_dropdown_pages( $args ); - ?>

- -

-

'sp_team', - 'name' => 'sp_past_team[]', - 'selected' => $past_teams, - 'values' => 'ID', - 'placeholder' => sprintf( __( 'Select %s', 'sportspress' ), __( 'Teams', 'sportspress' ) ), - 'class' => 'sp-past-teams widefat', - 'property' => 'multiple', - 'chosen' => true, - ); - sportspress_dropdown_pages( $args ); - ?>

- -

-

'sp_league', - 'name' => 'tax_input[sp_league][]', - 'selected' => $league_ids, - 'values' => 'term_id', - 'placeholder' => sprintf( __( 'Select %s', 'sportspress' ), __( 'Leagues', 'sportspress' ) ), - 'class' => 'widefat', - 'property' => 'multiple', - 'chosen' => true, - ); - sportspress_dropdown_taxonomies( $args ); - ?>

- -

-

'sp_season', - 'name' => 'tax_input[sp_season][]', - 'selected' => $season_ids, - 'values' => 'term_id', - 'placeholder' => sprintf( __( 'Select %s', 'sportspress' ), __( 'Seasons', 'sportspress' ) ), - 'class' => 'widefat', - 'property' => 'multiple', - 'chosen' => true, - ); - sportspress_dropdown_taxonomies( $args ); - ?>

- ID, 'sp_metrics', true ); - $positions = get_the_terms( $post->ID, 'sp_position' ); - - $args = array( - 'post_type' => 'sp_metric', - 'numberposts' => -1, - 'posts_per_page' => -1, - 'orderby' => 'menu_order', - 'order' => 'ASC', - ); - - if ( $positions ): - $position_ids = array(); - foreach( $positions as $position ): - $position_ids[] = $position->term_id; - endforeach; - $args['tax_query'] = array( - array( - 'taxonomy' => 'sp_position', - 'field' => 'id', - 'terms' => $position_ids, - ), - ); - endif; - - $vars = get_posts( $args ); - - if ( $vars ): - foreach ( $vars as $var ): - ?> -

post_title; ?>

-

- ID, 'sp_league' ); - - $league_num = sizeof( $leagues ); - - // Loop through performance for each league - foreach ( $leagues as $league ): - - if ( $league_num > 1 ): - ?> -

name; ?>

- ID, $league->term_id, true ); - - sportspress_edit_player_performance_table( $post->ID, $league->term_id, $columns, $data, $placeholders, $merged, $seasons_teams, ! current_user_can( 'edit_sp_teams' ) ); - - endforeach; -} diff --git a/admin/post-types/result.php b/admin/post-types/result.php deleted file mode 100644 index 520e19e9..00000000 --- a/admin/post-types/result.php +++ /dev/null @@ -1,54 +0,0 @@ - __( 'Results', 'sportspress' ), - 'singular_name' => __( 'Result', 'sportspress' ), - 'add_new_item' => __( 'Add New Result', 'sportspress' ), - 'edit_item' => __( 'Edit Result', 'sportspress' ), - 'new_item' => __( 'New', 'sportspress' ), - 'view_item' => __( 'View', 'sportspress' ), - 'search_items' => __( 'Search', 'sportspress' ), - 'not_found' => __( 'No results found.', 'sportspress' ), - 'not_found_in_trash' => __( 'No results found.', 'sportspress' ), - ); - $args = array( - 'label' => __( 'Results', 'sportspress' ), - 'labels' => $labels, - 'public' => false, - 'show_ui' => true, - 'show_in_menu' => false, - 'has_archive' => false, - 'hierarchical' => false, - 'can_export' => false, - 'supports' => array( 'title', 'page-attributes' ), - 'register_meta_box_cb' => 'sportspress_result_meta_init', - 'capability_type' => 'sp_config', - ); - register_post_type( 'sp_result', $args ); -} -add_action( 'init', 'sportspress_result_post_init' ); - -function sportspress_result_edit_columns() { - $columns = array( - 'cb' => '', - 'title' => __( 'Label', 'sportspress' ), - 'sp_key' => __( 'Key', 'sportspress' ), - ); - return $columns; -} -add_filter( 'manage_edit-sp_result_columns', 'sportspress_result_edit_columns' ); - -function sportspress_result_meta_init() { - add_meta_box( 'sp_detailsdiv', __( 'Details', 'sportspress' ), 'sportspress_result_details_meta', 'sp_result', 'normal', 'high' ); -} - -function sportspress_result_details_meta( $post ) { - $formats = sportspress_get_config_formats(); - ?> -

-

- -

- '', - 'public' => false, - 'show_ui' => true, - 'show_in_nav_menus' => false, - 'show_in_admin_bar' => false, - 'can_export' => false, - ); - register_post_type( 'sp_separator', $args ); -} -add_action( 'init', 'sportspress_separator_post_init' ); diff --git a/admin/post-types/staff.php b/admin/post-types/staff.php deleted file mode 100644 index 87d5cb84..00000000 --- a/admin/post-types/staff.php +++ /dev/null @@ -1,56 +0,0 @@ - __( 'Staff', 'sportspress' ), - 'singular_name' => __( 'Staff', 'sportspress' ), - 'add_new_item' => __( 'Add New Staff', 'sportspress' ), - 'edit_item' => __( 'Edit Staff', 'sportspress' ), - 'new_item' => __( 'New', 'sportspress' ), - 'view_item' => __( 'View', 'sportspress' ), - 'search_items' => __( 'Search', 'sportspress' ), - 'not_found' => __( 'No results found.', 'sportspress' ), - 'not_found_in_trash' => __( 'No results found.', 'sportspress' ), - ); - $args = array( - 'label' => __( 'Staff', 'sportspress' ), - 'labels' => $labels, - 'public' => true, - 'has_archive' => false, - 'hierarchical' => false, - 'supports' => array( 'title', 'author', 'thumbnail' ), - 'register_meta_box_cb' => 'sportspress_staff_meta_init', - 'rewrite' => array( 'slug' => get_option( 'sportspress_staff_slug', 'staff' ) ), - 'show_in_menu' => 'edit.php?post_type=sp_player', - 'capability_type' => 'sp_staff', - ); - register_post_type( 'sp_staff', $args ); -} -add_action( 'init', 'sportspress_staff_post_init' ); - -function sportspress_staff_meta_init() { - add_meta_box( 'sp_teamdiv', __( 'Teams', 'sportspress' ), 'sportspress_staff_team_meta', 'sp_staff', 'side', 'default' ); - add_meta_box( 'sp_profilediv', __( 'Profile', 'sportspress' ), 'sportspress_staff_profile_meta', 'sp_staff', 'normal', 'high' ); -} -function sportspress_staff_team_meta( $post ) { - sportspress_post_checklist( $post->ID, 'sp_team' ); - sportspress_post_adder( 'sp_team', __( 'Add New', 'sportspress' ) ); - sportspress_nonce(); -} - -function sportspress_staff_profile_meta( $post ) { - wp_editor( $post->post_content, 'content' ); -} - -function sportspress_staff_edit_columns() { - $columns = array( - 'cb' => '', - 'title' => __( 'Name', 'sportspress' ), - 'sp_position' => __( 'Positions', 'sportspress' ), - 'sp_team' => __( 'Teams', 'sportspress' ), - 'sp_league' => __( 'Leagues', 'sportspress' ), - 'sp_season' => __( 'Seasons', 'sportspress' ), - 'sp_views' => __( 'Views', 'sportspress' ), - ); - return $columns; -} -add_filter( 'manage_edit-sp_staff_columns', 'sportspress_staff_edit_columns' ); diff --git a/admin/post-types/table.php b/admin/post-types/table.php deleted file mode 100644 index fa0ba91f..00000000 --- a/admin/post-types/table.php +++ /dev/null @@ -1,118 +0,0 @@ - __( 'League Tables', 'sportspress' ), - 'singular_name' => __( 'League Table', 'sportspress' ), - 'add_new_item' => __( 'Add New League Table', 'sportspress' ), - 'edit_item' => __( 'Edit League Table', 'sportspress' ), - 'new_item' => __( 'New', 'sportspress' ), - 'view_item' => __( 'View', 'sportspress' ), - 'search_items' => __( 'Search', 'sportspress' ), - 'not_found' => __( 'No results found.', 'sportspress' ), - 'not_found_in_trash' => __( 'No results found.', 'sportspress' ), - ); - $args = array( - 'label' => __( 'League Tables', 'sportspress' ), - 'labels' => $labels, - 'public' => true, - 'has_archive' => false, - 'hierarchical' => false, - 'supports' => array( 'title', 'author', 'thumbnail' ), - 'register_meta_box_cb' => 'sportspress_table_meta_init', - 'rewrite' => array( 'slug' => get_option( 'sportspress_table_slug', 'table' ) ), - 'show_in_menu' => 'edit.php?post_type=sp_team', - 'show_in_admin_bar' => true, - 'capability_type' => 'sp_table', - ); - register_post_type( 'sp_table', $args ); -} -add_action( 'init', 'sportspress_table_post_init' ); - -function sportspress_table_edit_columns() { - $columns = array( - 'cb' => '', - 'title' => __( 'Title', 'sportspress' ), - 'sp_league' => __( 'League', 'sportspress' ), - 'sp_season' => __( 'Season', 'sportspress' ), - 'sp_team' => __( 'Teams', 'sportspress' ), - 'sp_views' => __( 'Views', 'sportspress' ), - ); - return $columns; -} -add_filter( 'manage_edit-sp_table_columns', 'sportspress_table_edit_columns' ); - -function sportspress_table_meta_init( $post ) { - $teams = (array)get_post_meta( $post->ID, 'sp_team', false ); - - remove_meta_box( 'sp_seasondiv', 'sp_table', 'side' ); - remove_meta_box( 'sp_leaguediv', 'sp_table', 'side' ); - add_meta_box( 'sp_shortcodediv', __( 'Shortcode', 'sportspress' ), 'sportspress_table_shortcode_meta', 'sp_table', 'side', 'default' ); - add_meta_box( 'sp_teamdiv', __( 'Teams', 'sportspress' ), 'sportspress_table_team_meta', 'sp_table', 'side', 'default' ); - add_meta_box( 'sp_columnsdiv', __( 'League Table', 'sportspress' ), 'sportspress_table_columns_meta', 'sp_table', 'normal', 'high' ); - add_meta_box( 'sp_descriptiondiv', __( 'Description', 'sportspress' ), 'sportspress_table_description_meta', 'sp_table', 'normal', 'high' ); -} - -function sportspress_table_shortcode_meta( $post ) { - ?> -

- -

-

- ID, 'sp_league', 0 ); - $season_id = sportspress_get_the_term_id( $post->ID, 'sp_season', 0 ); - ?> -
-

-

- 'sp_league', - 'name' => 'sp_league', - 'selected' => $league_id, - 'values' => 'term_id' - ); - if ( ! sportspress_dropdown_taxonomies( $args ) ): - sportspress_taxonomy_adder( 'sp_league', 'sp_team', __( 'Add New', 'sportspress' ) ); - endif; - ?> -

-

-

- 'sp_season', - 'name' => 'sp_season', - 'selected' => $season_id, - 'values' => 'term_id' - ); - if ( ! sportspress_dropdown_taxonomies( $args ) ): - sportspress_taxonomy_adder( 'sp_season', 'sp_team', __( 'Add New', 'sportspress' ) ); - endif; - ?> -

-

- ID, 'sp_team', 'block', 'sp_season' ); - sportspress_post_adder( 'sp_team', __( 'Add New', 'sportspress' ) ); - ?> -
- ID, true ); - - sportspress_edit_league_table( $columns, $usecolumns, $data, $placeholders ); - - sportspress_nonce(); -} - -function sportspress_table_description_meta( $post ) { - wp_editor( $post->post_content, 'content' ); -} diff --git a/admin/post-types/team.php b/admin/post-types/team.php deleted file mode 100644 index 7e7ecc67..00000000 --- a/admin/post-types/team.php +++ /dev/null @@ -1,76 +0,0 @@ - __( 'Teams', 'sportspress' ), - 'singular_name' => __( 'Team', 'sportspress' ), - 'add_new_item' => __( 'Add New Team', 'sportspress' ), - 'edit_item' => __( 'Edit Team', 'sportspress' ), - 'new_item' => __( 'New', 'sportspress' ), - 'view_item' => __( 'View', 'sportspress' ), - 'search_items' => __( 'Search', 'sportspress' ), - 'not_found' => __( 'No results found.', 'sportspress' ), - 'not_found_in_trash' => __( 'No results found.', 'sportspress' ), - 'parent_item_colon' => __( 'Parent:', 'sportspress' ), - ); - $args = array( - 'label' => __( 'Teams', 'sportspress' ), - 'labels' => $labels, - 'public' => true, - 'has_archive' => false, - 'hierarchical' => true, - 'supports' => array( 'title', 'editor', 'author', 'thumbnail', 'page-attributes' ), - 'register_meta_box_cb' => 'sportspress_team_meta_init', - 'rewrite' => array( 'slug' => get_option( 'sportspress_teams_slug', 'teams' ) ), - 'menu_icon' => 'dashicons-shield-alt', - 'capability_type' => 'sp_team', - ); - register_post_type( 'sp_team', $args ); -} -add_action( 'init', 'sportspress_team_post_init' ); - -function sportspress_team_meta_init( $post ) { - $leagues = get_the_terms( $post->ID, 'sp_league' ); - $seasons = get_the_terms( $post->ID, 'sp_season' ); - - if ( $leagues && $seasons ): - add_meta_box( 'sp_columnssdiv', __( 'Columns', 'sportspress' ), 'sportspress_team_columns_meta', 'sp_team', 'normal', 'high' ); - endif; -} - -function sportspress_team_edit_columns() { - $columns = array( - 'cb' => '', - 'sp_icon' => '', - 'title' => __( 'Team', 'sportspress' ), - 'sp_league' => __( 'Leagues', 'sportspress' ), - 'sp_season' => __( 'Seasons', 'sportspress' ), - 'sp_views' => __( 'Views', 'sportspress' ), - ); - return $columns; -} -add_filter( 'manage_edit-sp_team_columns', 'sportspress_team_edit_columns' ); - -function sportspress_team_columns_meta( $post ) { - $leagues = (array)get_the_terms( $post->ID, 'sp_league' ); - - $league_num = sizeof( $leagues ); - - // Loop through columns for each league - foreach ( $leagues as $league ): - - $league_id = $league->term_id; - - if ( $league_num > 1 ): - ?> -

name; ?>

- ID, $league_id, true ); - - sportspress_edit_team_columns_table( $league_id, $columns, $data, $placeholders, $merged, $leagues_seasons, ! current_user_can( 'edit_sp_tables' ) ); - - endforeach; - - sportspress_nonce(); -} diff --git a/sportspress.php b/sportspress.php index ab9546d1..6fa0c46e 100644 --- a/sportspress.php +++ b/sportspress.php @@ -207,23 +207,6 @@ final class SportsPress { include_once( 'includes/admin/settings/options-text.php' ); include_once( 'includes/admin/settings/options-permalink.php' ); - // Custom post types (deprecating) - //include_once( 'admin/post-types/separator.php' ); - //include_once( 'admin/post-types/column.php' ); - //include_once( 'admin/post-types/performance.php' ); - //include_once( 'admin/post-types/statistic.php' ); - //include_once( 'admin/post-types/metric.php' ); - //include_once( 'admin/post-types/result.php' ); - //include_once( 'admin/post-types/outcome.php' ); - //include_once( 'admin/post-types/event.php' ); - //include_once( 'admin/post-types/calendar.php' ); - //include_once( 'admin/post-types/team.php' ); - //include_once( 'admin/post-types/table.php' ); - //include_once( 'admin/post-types/player.php' ); - //include_once( 'admin/post-types/list.php' ); - //include_once( 'admin/post-types/staff.php' ); - //include_once( 'admin/post-types/directory.php' ); - if ( is_admin() ) { include_once( 'includes/admin/class-sp-admin.php' ); }