diff --git a/admin/post-types/event.php b/admin/post-types/event.php index 51228f3f..a39adcc4 100644 --- a/admin/post-types/event.php +++ b/admin/post-types/event.php @@ -142,7 +142,7 @@ function sp_event_edit_columns() { 'cb' => '', 'title' => __( 'Event', 'sportspress' ), 'sp_team' => __( 'Teams', 'sportspress' ), - 'sp_div' => __( 'Divisions', 'sportspress' ), + 'sp_league' => __( 'Leagues', 'sportspress' ), 'sp_kickoff' => __( 'Kick-off', 'sportspress' ) ); return $columns; diff --git a/admin/post-types/list.php b/admin/post-types/list.php index 3e334874..89b56f66 100644 --- a/admin/post-types/list.php +++ b/admin/post-types/list.php @@ -24,7 +24,7 @@ function sp_list_edit_columns() { 'title' => __( 'Title' ), 'sp_player' => __( 'Players', 'sportspress' ), 'sp_team' => __( 'Teams', 'sportspress' ), - 'sp_div' => __( 'Divisions', 'sportspress' ) + 'sp_league' => __( 'Leagues', 'sportspress' ) ); return $columns; } @@ -41,17 +41,17 @@ function sp_list_meta_init( $post ) { } function sp_list_player_meta( $post ) { - $division_id = sp_get_the_term_id( $post->ID, 'sp_div', 0 ); + $league_id = sp_get_the_term_id( $post->ID, 'sp_league', 0 ); $team_id = get_post_meta( $post->ID, 'sp_team', true ); ?>

sprintf( __( 'Select %s', 'sportspress' ), __( 'Division', 'sportspress' ) ), - 'taxonomy' => 'sp_div', - 'name' => 'sp_div', - 'selected' => $division_id + 'show_option_none' => sprintf( __( 'Select %s', 'sportspress' ), __( 'League', 'sportspress' ) ), + 'taxonomy' => 'sp_league', + 'name' => 'sp_league', + 'selected' => $league_id ); sp_dropdown_taxonomies( $args ); ?> diff --git a/admin/post-types/player.php b/admin/post-types/player.php index 88efc356..c26c47b6 100644 --- a/admin/post-types/player.php +++ b/admin/post-types/player.php @@ -20,7 +20,7 @@ add_action( 'init', 'sp_player_cpt_init' ); function sp_player_meta_init( $post ) { $teams = (array)get_post_meta( $post->ID, 'sp_team', false ); - $divisions = (array)get_the_terms( $post->ID, 'sp_div' ); + $leagues = (array)get_the_terms( $post->ID, 'sp_league' ); remove_meta_box( 'submitdiv', 'sp_player', 'side' ); add_meta_box( 'submitdiv', __( 'Publish' ), 'post_submit_meta_box', 'sp_player', 'side', 'high' ); @@ -28,7 +28,7 @@ function sp_player_meta_init( $post ) { add_meta_box( 'postimagediv', __( 'Photo', 'sportspress' ), 'post_thumbnail_meta_box', 'sp_player', 'side', 'high' ); add_meta_box( 'sp_teamdiv', __( 'Teams', 'sportspress' ), 'sp_player_team_meta', 'sp_player', 'side', 'high' ); - if ( $teams && $teams != array(0) && $divisions && $divisions != array(0) ): + if ( $teams && $teams != array(0) && $leagues && $leagues != array(0) ): add_meta_box( 'sp_statsdiv', __( 'Statistics', 'sportspress' ), 'sp_player_stats_meta', 'sp_player', 'normal', 'high' ); endif; @@ -43,7 +43,7 @@ function sp_player_team_meta( $post ) { function sp_player_stats_meta( $post ) { $team_ids = (array)get_post_meta( $post->ID, 'sp_team', false ); - $divisions = (array)get_the_terms( $post->ID, 'sp_div' ); + $leagues = (array)get_the_terms( $post->ID, 'sp_league' ); $stats = (array)get_post_meta( $post->ID, 'sp_metrics', true ); // Equation Operating System @@ -52,9 +52,9 @@ function sp_player_stats_meta( $post ) { // Get labels from metric variables $metric_labels = (array)sp_get_var_labels( 'sp_metric' ); - // Generate array of all division ids + // Generate array of all league ids $div_ids = array(); - foreach ( $divisions as $key => $value ): + foreach ( $leagues as $key => $value ): if ( is_object( $value ) && property_exists( $value, 'term_id' ) ) $div_ids[] = $value->term_id; endforeach; @@ -78,7 +78,7 @@ function sp_player_stats_meta( $post ) { $data = array(); - // Get all divisions populated with stats where available + // Get all leagues populated with stats where available $data[ $team_id ] = sp_array_combine( $div_ids, $stats[ $team_id ] ); // Get equations from statistics variables @@ -109,7 +109,7 @@ function sp_player_stats_meta( $post ) { ), 'tax_query' => array( array( - 'taxonomy' => 'sp_div', + 'taxonomy' => 'sp_league', 'field' => 'id', 'terms' => $div_id ) @@ -133,7 +133,7 @@ function sp_player_stats_meta( $post ) { endif; endforeach; - // Generate array of placeholder values for each division + // Generate array of placeholder values for each league $placeholders[ $team_id ][ $div_id ] = array(); foreach ( $equations as $key => $value ): @@ -175,9 +175,9 @@ function sp_player_edit_columns() { $columns = array( 'cb' => '', 'title' => __( 'Name', 'sportspress' ), - 'sp_pos' => __( 'Positions', 'sportspress' ), + 'sp_position' => __( 'Positions', 'sportspress' ), 'sp_team' => __( 'Teams', 'sportspress' ), - 'sp_div' => __( 'Divisions', 'sportspress' ) + 'sp_league' => __( 'Leagues', 'sportspress' ) ); return $columns; } diff --git a/admin/post-types/staff.php b/admin/post-types/staff.php index 27b25de8..ae3fd004 100644 --- a/admin/post-types/staff.php +++ b/admin/post-types/staff.php @@ -40,9 +40,9 @@ function sp_staff_edit_columns() { $columns = array( 'cb' => '', 'title' => __( 'Name', 'sportspress' ), - 'sp_pos' => __( 'Positions', 'sportspress' ), + 'sp_position' => __( 'Positions', 'sportspress' ), 'sp_team' => __( 'Teams', 'sportspress' ), - 'sp_div' => __( 'Divisions', 'sportspress' ), + 'sp_league' => __( 'Leagues', 'sportspress' ), ); return $columns; } diff --git a/admin/post-types/table.php b/admin/post-types/table.php index e8b313e3..1c471262 100644 --- a/admin/post-types/table.php +++ b/admin/post-types/table.php @@ -23,7 +23,7 @@ function sp_table_edit_columns() { 'cb' => '', 'title' => __( 'Title' ), 'sp_team' => __( 'Teams', 'sportspress' ), - 'sp_div' => __( 'Divisions', 'sportspress' ), + 'sp_league' => __( 'Leagues', 'sportspress' ), ); return $columns; } @@ -40,22 +40,22 @@ function sp_table_meta_init( $post ) { } function sp_table_team_meta( $post, $test ) { - $division_id = sp_get_the_term_id( $post->ID, 'sp_div', 0 ); + $league_id = sp_get_the_term_id( $post->ID, 'sp_league', 0 ); ?>

sprintf( __( 'Select %s', 'sportspress' ), __( 'Division', 'sportspress' ) ), - 'taxonomy' => 'sp_div', - 'name' => 'sp_div', - 'selected' => $division_id + 'show_option_none' => sprintf( __( 'Select %s', 'sportspress' ), __( 'League', 'sportspress' ) ), + 'taxonomy' => 'sp_league', + 'name' => 'sp_league', + 'selected' => $league_id ); sp_dropdown_taxonomies( $args ); ?>

ID, 'sp_team', 'block', 'sp_div' ); + sp_post_checklist( $post->ID, 'sp_team', 'block', 'sp_league' ); sp_post_adder( 'sp_team' ); ?>
diff --git a/admin/post-types/team.php b/admin/post-types/team.php index 61fcbd8e..377fe68d 100644 --- a/admin/post-types/team.php +++ b/admin/post-types/team.php @@ -19,14 +19,14 @@ function sp_team_cpt_init() { add_action( 'init', 'sp_team_cpt_init' ); function sp_team_meta_init( $post ) { - $divisions = (array)get_the_terms( $post->ID, 'sp_div' ); + $leagues = (array)get_the_terms( $post->ID, 'sp_league' ); remove_meta_box( 'submitdiv', 'sp_team', 'side' ); add_meta_box( 'submitdiv', __( 'Publish' ), 'post_submit_meta_box', 'sp_team', 'side', 'high' ); remove_meta_box( 'postimagediv', 'sp_team', 'side' ); add_meta_box( 'postimagediv', __( 'Logo', 'sportspress' ), 'post_thumbnail_meta_box', 'sp_team', 'side', 'high' ); - if ( $divisions && $divisions != array(0) ): + if ( $leagues && $leagues != array(0) ): add_meta_box( 'sp_statsdiv', __( 'Statistics', 'sportspress' ), 'sp_team_stats_meta', 'sp_team', 'normal', 'high' ); endif; } @@ -36,14 +36,14 @@ function sp_team_edit_columns() { 'cb' => '', 'sp_logo' => ' ', 'title' => __( 'Team', 'sportspress' ), - 'sp_div' => __( 'Divisions', 'sportspress' ) + 'sp_league' => __( 'Leagues', 'sportspress' ) ); return $columns; } add_filter( 'manage_edit-sp_team_columns', 'sp_team_edit_columns' ); function sp_team_stats_meta( $post ) { - $divisions = (array)get_the_terms( $post->ID, 'sp_div' ); + $leagues = (array)get_the_terms( $post->ID, 'sp_league' ); $stats = (array)get_post_meta( $post->ID, 'sp_stats', true ); // Equation Operating System @@ -55,14 +55,14 @@ function sp_team_stats_meta( $post ) { // Get labels from outcome variables $outcome_labels = (array)sp_get_var_labels( 'sp_outcome' ); - // Generate array of all division ids + // Generate array of all league ids $div_ids = array(); - foreach ( $divisions as $key => $value ): + foreach ( $leagues as $key => $value ): if ( is_object( $value ) && property_exists( $value, 'term_id' ) ) $div_ids[] = $value->term_id; endforeach; - // Get all divisions populated with stats where available + // Get all leagues populated with stats where available $data = sp_array_combine( $div_ids, $stats ); // Get equations from statistics variables @@ -96,7 +96,7 @@ function sp_team_stats_meta( $post ) { ), 'tax_query' => array( array( - 'taxonomy' => 'sp_div', + 'taxonomy' => 'sp_league', 'field' => 'id', 'terms' => $div_id ) @@ -130,7 +130,7 @@ function sp_team_stats_meta( $post ) { endforeach; endforeach; - // Generate array of placeholder values for each division + // Generate array of placeholder values for each league $placeholders[ $div_id ] = array(); foreach ( $equations as $key => $value ): $placeholders[ $div_id ][ $key ] = $eos->solveIF( str_replace( ' ', '', $value ), $totals ); diff --git a/admin/terms/div.php b/admin/terms/div.php deleted file mode 100644 index c658f673..00000000 --- a/admin/terms/div.php +++ /dev/null @@ -1,18 +0,0 @@ - $name, - 'labels' => $labels, - 'public' => true, - 'hierarchical' => true, - 'rewrite' => array( 'slug' => 'division' ) - ); - register_taxonomy( 'sp_div', $object_type, $args ); -} -add_action( 'init', 'sp_div_term_init' ); -?> \ No newline at end of file diff --git a/admin/terms/league.php b/admin/terms/league.php new file mode 100644 index 00000000..50ae1908 --- /dev/null +++ b/admin/terms/league.php @@ -0,0 +1,18 @@ + $name, + 'labels' => $labels, + 'public' => true, + 'hierarchical' => true, + 'rewrite' => array( 'slug' => 'league' ) + ); + register_taxonomy( 'sp_league', $object_type, $args ); +} +add_action( 'init', 'sp_league_term_init' ); +?> \ No newline at end of file diff --git a/admin/terms/pos.php b/admin/terms/position.php similarity index 61% rename from admin/terms/pos.php rename to admin/terms/position.php index fe36e3de..46ea12e5 100644 --- a/admin/terms/pos.php +++ b/admin/terms/position.php @@ -1,5 +1,5 @@ true, 'rewrite' => array( 'slug' => 'position' ) ); - register_taxonomy( 'sp_pos', $object_type, $args ); - register_taxonomy_for_object_type( 'sp_pos', 'sp_player' ); - register_taxonomy_for_object_type( 'sp_pos', 'sp_staff' ); + register_taxonomy( 'sp_position', $object_type, $args ); + register_taxonomy_for_object_type( 'sp_position', 'sp_player' ); + register_taxonomy_for_object_type( 'sp_position', 'sp_staff' ); } -add_action( 'init', 'sp_pos_term_init' ); +add_action( 'init', 'sp_position_term_init' ); ?> \ No newline at end of file diff --git a/classes/shortcodes/table.php b/classes/shortcodes/table.php index e817eb6d..cf347e49 100644 --- a/classes/shortcodes/table.php +++ b/classes/shortcodes/table.php @@ -7,7 +7,7 @@ function sp_table_shortcode( $atts, $content = null, $code = "" ) { 'div' => 0 ), $atts ) ); - // Get all teams in the division + // Get all teams in the league $args = array( 'post_type' => 'sp_team', 'numberposts' => -1, @@ -16,7 +16,7 @@ function sp_table_shortcode( $atts, $content = null, $code = "" ) { ); if ( $div ) { $args['tax_query'][] = array( - 'taxonomy' => 'sp_div', + 'taxonomy' => 'sp_league', 'terms' => $div, 'field' => 'term_id' ); diff --git a/readme.txt b/readme.txt index d58f81d2..ecd68b29 100644 --- a/readme.txt +++ b/readme.txt @@ -1,6 +1,6 @@ === SportsPress === Contributors: themeboy -Tags: sports, sports journalism, teams, team management, fixtures, results, standings, league tables, divisions, reporting, themeboy, wordpress sports, configurable +Tags: sports, sports journalism, teams, team management, fixtures, results, standings, league tables, leagues, reporting, themeboy, wordpress sports, configurable Requires at least: 3.5 Tested up to: 3.6 Stable tag: 0.1.2 diff --git a/sportspress-actions.php b/sportspress-actions.php index 1802546f..b6ce6f12 100644 --- a/sportspress-actions.php +++ b/sportspress-actions.php @@ -22,13 +22,13 @@ function sp_admin_menu() { // Remove "Add Event" link under Events unset( $submenu['edit.php?post_type=sp_event'][10] ); - // Remove "Divisions" link under Events + // Remove "Leagues" link under Events unset( $submenu['edit.php?post_type=sp_event'][15] ); - // Remove "Divisions" link under Players + // Remove "Leagues" link under Players unset( $submenu['edit.php?post_type=sp_player'][15] ); - // Remove "Divisions" link under Staff + // Remove "Leagues" link under Staff unset( $submenu['edit.php?post_type=sp_staff'][15] ); } add_action( 'admin_menu', 'sp_admin_menu' ); @@ -39,8 +39,8 @@ function sp_manage_posts_custom_column( $column, $post_id ) { case 'sp_logo': edit_post_link( get_the_post_thumbnail( $post_id, 'sp_icon' ), '', '', $post_id ); break; - case 'sp_pos': - echo get_the_terms ( $post_id, 'sp_pos' ) ? the_terms( $post_id, 'sp_pos' ) : '—'; + case 'sp_position': + echo get_the_terms ( $post_id, 'sp_position' ) ? the_terms( $post_id, 'sp_position' ) : '—'; break; case 'sp_team': $result = get_post_meta( $post_id, 'sp_result', false ); @@ -71,8 +71,8 @@ function sp_manage_posts_custom_column( $column, $post_id ) { case 'sp_event': echo get_post_meta ( $post_id, 'sp_event' ) ? sizeof( get_post_meta ( $post_id, 'sp_event' ) ) : '—'; break; - case 'sp_div': - echo get_the_terms ( $post_id, 'sp_div' ) ? the_terms( $post_id, 'sp_div' ) : '—'; + case 'sp_league': + echo get_the_terms ( $post_id, 'sp_league' ) ? the_terms( $post_id, 'sp_league' ) : '—'; break; case 'sp_sponsor': echo get_the_terms ( $post_id, 'sp_sponsor' ) ? the_terms( $post_id, 'sp_sponsor' ) : '—'; @@ -101,21 +101,21 @@ function sp_restrict_manage_posts() { // wp_dropdown_pages( $args ); endif; if ( in_array( $typenow, array( 'sp_player', 'sp_staff' ) ) ): - $selected = isset( $_REQUEST['sp_pos'] ) ? $_REQUEST['sp_pos'] : null; + $selected = isset( $_REQUEST['sp_position'] ) ? $_REQUEST['sp_position'] : null; $args = array( 'show_option_all' => sprintf( __( 'All %s', 'sportspress' ), __( 'Positions', 'sportspress' ) ), - 'taxonomy' => 'sp_pos', - 'name' => 'sp_pos', + 'taxonomy' => 'sp_position', + 'name' => 'sp_position', 'selected' => $selected ); sp_dropdown_taxonomies( $args ); endif; if ( in_array( $typenow, array( 'sp_team', 'sp_event', 'sp_player', 'sp_staff', 'sp_table', 'sp_list' ) ) ): - $selected = isset( $_REQUEST['sp_div'] ) ? $_REQUEST['sp_div'] : null; + $selected = isset( $_REQUEST['sp_league'] ) ? $_REQUEST['sp_league'] : null; $args = array( - 'show_option_all' => sprintf( __( 'All %s', 'sportspress' ), __( 'Divisions', 'sportspress' ) ), - 'taxonomy' => 'sp_div', - 'name' => 'sp_div', + 'show_option_all' => sprintf( __( 'All %s', 'sportspress' ), __( 'Leagues', 'sportspress' ) ), + 'taxonomy' => 'sp_league', + 'name' => 'sp_league', 'selected' => $selected ); sp_dropdown_taxonomies( $args ); @@ -208,13 +208,13 @@ function sp_save_post( $post_id ) { break; case ( 'sp_table' ): update_post_meta( $post_id, 'sp_teams', sp_array_value( $_POST, 'sp_teams', array() ) ); - wp_set_post_terms( $post_id, sp_array_value( $_POST, 'sp_div', 0 ), 'sp_div' ); + wp_set_post_terms( $post_id, sp_array_value( $_POST, 'sp_league', 0 ), 'sp_league' ); sp_update_post_meta_recursive( $post_id, 'sp_team', sp_array_value( $_POST, 'sp_team', array() ) ); break; case ( 'sp_list' ): update_post_meta( $post_id, 'sp_players', sp_array_value( $_POST, 'sp_players', array() ) ); update_post_meta( $post_id, 'sp_team', sp_array_value( $_POST, 'sp_team', array() ) ); - wp_set_post_terms( $post_id, sp_array_value( $_POST, 'sp_div', 0 ), 'sp_div' ); + wp_set_post_terms( $post_id, sp_array_value( $_POST, 'sp_league', 0 ), 'sp_league' ); sp_update_post_meta_recursive( $post_id, 'sp_player', sp_array_value( $_POST, 'sp_player', array() ) ); break; endswitch; diff --git a/sportspress-functions.php b/sportspress-functions.php index 22778f84..2c60a408 100644 --- a/sportspress-functions.php +++ b/sportspress-functions.php @@ -243,7 +243,7 @@ if ( !function_exists( 'sp_post_checklist' ) ) { $parents = get_post_ancestors( $post ); if ( $filter ): $filter_values = (array)get_post_meta( $post->ID, $filter, false ); - $terms = (array)get_the_terms( $post->ID, 'sp_div' ); + $terms = (array)get_the_terms( $post->ID, 'sp_league' ); foreach ( $terms as $term ): if ( is_object( $term ) && property_exists( $term, 'term_id' ) ) $filter_values[] = $term->term_id; @@ -457,7 +457,7 @@ if ( !function_exists( 'sp_league_table' ) ) { $i = 0; foreach ( $data as $team_id => $team_stats ): if ( !$team_id ) continue; - $div = get_term( $team_id, 'sp_div' ); + $div = get_term( $team_id, 'sp_league' ); ?> @@ -497,7 +497,7 @@ if ( !function_exists( 'sp_player_table' ) ) { $i = 0; foreach ( $data as $player_id => $player_stats ): if ( !$player_id ) continue; - $div = get_term( $player_id, 'sp_div' ); + $div = get_term( $player_id, 'sp_league' ); ?> @@ -526,7 +526,7 @@ if ( !function_exists( 'sp_team_stats_table' ) ) { - + @@ -538,13 +538,13 @@ if ( !function_exists( 'sp_team_stats_table' ) ) { if ( empty( $data ) ): ?> - + $div_stats ): if ( !$div_id ) continue; - $div = get_term( $div_id, 'sp_div' ); + $div = get_term( $div_id, 'sp_league' ); ?>
@@ -574,7 +574,7 @@ if ( !function_exists( 'sp_player_metrics_table' ) ) { - + @@ -592,7 +592,7 @@ if ( !function_exists( 'sp_player_metrics_table' ) ) { endif; foreach ( $team_stats as $div_id => $div_stats ): if ( !$div_id ) continue; - $div = get_term( $div_id, 'sp_div' ); + $div = get_term( $div_id, 'sp_league' ); ?>
@@ -777,7 +777,7 @@ if ( !function_exists( 'sportspress_render_option_field' ) ) { if ( !function_exists( 'sp_get_table' ) ) { function sp_get_table( $post_id, $breakdown = false ) { - $div_id = sp_get_the_term_id( $post_id, 'sp_div', 0 ); + $div_id = sp_get_the_term_id( $post_id, 'sp_league', 0 ); $team_ids = (array)get_post_meta( $post_id, 'sp_team', false ); $table_stats = (array)get_post_meta( $post_id, 'sp_teams', true ); @@ -790,7 +790,7 @@ if ( !function_exists( 'sp_get_table' ) ) { // Get labels from outcome variables $outcome_labels = (array)sp_get_var_labels( 'sp_outcome' ); - // Get all divisions populated with stats where available + // Get all leagues populated with stats where available $tempdata = sp_array_combine( $team_ids, $table_stats ); // Create entry for each team in totals @@ -831,7 +831,7 @@ if ( !function_exists( 'sp_get_table' ) ) { 'posts_per_page' => -1, 'tax_query' => array( array( - 'taxonomy' => 'sp_div', + 'taxonomy' => 'sp_league', 'field' => 'id', 'terms' => $div_id ) @@ -978,7 +978,7 @@ if ( !function_exists( 'sp_get_table' ) ) { if ( !function_exists( 'sp_get_list' ) ) { function sp_get_list( $post_id, $breakdown = false ) { - $div_id = sp_get_the_term_id( $post_id, 'sp_div', 0 ); + $div_id = sp_get_the_term_id( $post_id, 'sp_league', 0 ); $team_id = get_post_meta( $post_id, 'sp_team', true ); $player_ids = (array)get_post_meta( $post_id, 'sp_player', false ); $stats = (array)get_post_meta( $post_id, 'sp_players', true ); @@ -989,7 +989,7 @@ if ( !function_exists( 'sp_get_list' ) ) { // Get labels from result variables $columns = (array)sp_get_var_labels( 'sp_metric' ); - // Get all divisions populated with stats where available + // Get all leagues populated with stats where available $tempdata = sp_array_combine( $player_ids, $stats ); // Get equations from statistics variables @@ -1027,7 +1027,7 @@ if ( !function_exists( 'sp_get_list' ) ) { 'posts_per_page' => -1, 'tax_query' => array( array( - 'taxonomy' => 'sp_div', + 'taxonomy' => 'sp_league', 'field' => 'id', 'terms' => $div_id ) diff --git a/sportspress.php b/sportspress.php index 73870da0..d7f3c956 100644 --- a/sportspress.php +++ b/sportspress.php @@ -46,8 +46,8 @@ require_once dirname( __FILE__ ) . '/admin/post-types/list.php'; require_once dirname( __FILE__ ) . '/admin/post-types/staff.php'; // Terms -require_once dirname( __FILE__ ) . '/admin/terms/div.php'; -require_once dirname( __FILE__ ) . '/admin/terms/pos.php'; +require_once dirname( __FILE__ ) . '/admin/terms/league.php'; +require_once dirname( __FILE__ ) . '/admin/terms/position.php'; // Shortcodes // require_once dirname( __FILE__ ) . '/classes/shortcodes/table.php';